Hi,
I have a main workbook (Main.xlsm) and a bunch of subsidiary ones (Book1.xlsm, Book2.xlsm, etc.). All have the same macros in them. I'd like to create a subroutine in Main with a button that runs a given macro in all the other workbooks (*except* Main), using the macro in each workbook. All the workbooks will be open when this happens. I've tried this:
However, this code is in a module in Main, and what it does is run Macro1 from the subsidiary book in Main. How can I run Macro1 from each subsidiary book in that book?
Thanks.
I have a main workbook (Main.xlsm) and a bunch of subsidiary ones (Book1.xlsm, Book2.xlsm, etc.). All have the same macros in them. I'd like to create a subroutine in Main with a button that runs a given macro in all the other workbooks (*except* Main), using the macro in each workbook. All the workbooks will be open when this happens. I've tried this:
Code:
Sub RunAll()
Dim Book As Workbook
For Each Book In Workbooks
Application.Run "Macro1"
Next Book
End Sub
However, this code is in a module in Main, and what it does is run Macro1 from the subsidiary book in Main. How can I run Macro1 from each subsidiary book in that book?
Thanks.