+ Reply to Thread
Results 1 to 2 of 2

1 macro to run a macro on multiple sheets

  1. #1
    Forum Contributor
    Join Date
    07-01-2017
    Location
    Las Vegas, NV
    MS-Off Ver
    Office 2013
    Posts
    132

    1 macro to run a macro on multiple sheets

    I created sheet 1 & 2 of my project. Sheet 1 is an input page where a user will enter information. Sheet 2 is just a summary of the information on Sheet 1. I have a reset macro that clears the contents of multiple ranges on Sheet 1.

    I need to have 10 pairs of sheets (10 input sheets & 10 summary sheets). All of the odd number sheets are identical, but with different data. All of the even sheets are identical but the data summarized is specific to the sheet before it.

    When I made a copy of the first 2 sheets (added them to the end), was copied as well, with the same name as the macro on Sheet 1. The macro I had on sheet 1 still resets the data on that sheet, but not any of the copies I created. On the copy sheets, I can activate the same macro and it and it will reset the information for that specific page.

    Is there a command I can use that will run the macro on a specific set of sheets all from the first sheet? So I can press a button I've assigned the reset macro on sheet 1 and it will reset all of the data on sheet 3, sheet 5, sheet 7, sheet 9, etc.

  2. #2
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,613

    Re: 1 macro to run a macro on multiple sheets

    You shall pass the name of the sheets to the macro.

    If I understand well, you have now several copies of the same macro but residing in modules of different sheets. It's rather rarely usefull, and probably it would be better to store the macros in standard module (not sheet module).

    Or may be you shall check what macros are assigned to buttons (anyway, I expect that even if it is - and probably it is - all the time the same macro, it is written not as a "sheet independent" one, but has the reference to particular sheet in it's code.

    But not seeing the macro code neither the sample file it's not easy to give detailed description what exactly shall be changed.
    Best Regards,

    Kaper

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Macro to pull multiple images from folder to multiple sheets by image/sheet name
    By MrSTruct in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 08-15-2022, 08:32 AM
  2. [VBA] Tricky request! Moving sheets, calling macro within macro, applying to all sheets.
    By excelfriend1 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 03-22-2016, 10:48 PM
  3. [SOLVED] Regression macro on multiple sheets, excluding certain sheets
    By sfostrom in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 02-12-2016, 05:16 PM
  4. Macro - Refresh Multiple Protected Pivtos (on Multiple Sheets) Upon Workbook Opening
    By luke.walker in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-26-2014, 05:18 PM
  5. Replies: 2
    Last Post: 09-19-2013, 04:22 AM
  6. [SOLVED] Macro error when ran on multiple sheets on workbook (even though macro works)
    By steven_e in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-02-2012, 06:09 PM
  7. Macro on multiple sheets - grouped sheets
    By stan1472 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-24-2012, 12:13 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1