Excel 2007 Macro

  • Thread starter Thread starter tymahtin
  • Start date Start date
T

tymahtin

I have created a macro in 5 separate workbooks that run various tasks
and all update off of a single sheet. I would like to make a macro on
that single sheet that goes to each one of the separate sheets and
starts those macros.

Is there a way to do that?
 
In one place you say "5 different workbooks" and then later you say"goes to
.... the separate sheets".

Are we talking about one .xls file with 5 or 6 sheets (tabs) in it, or are
we talking about 6 different .xls files?

If everything is in the same .xls file, then this should work for you, just
change the names of the sheets and "MyMacro" to what they need to be:

Sub DoAllSheets()
Dim startingSheet As String
startingSheet=ActiveSheet.Name
Worksheets("firstSheetName").Activate
Run "MyMacro"
Worksheets("secondSheetName").Activate
Run "MyMacro"
Worksheets("thirdSheetName").Activate
Run "MyMacro"
Worksheets("fourthSheetName").activate
Run "MyMacro"
Worksheeets("AnotherSheetName").Activate
Run "MyMacro"
Worksheets(startingSheet).Activate
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top