Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Run a series of Macros from within a macro 4

Status
Not open for further replies.

sterlecki

Technical User
Joined
Oct 25, 2003
Messages
181
Location
US
I have several excel macros stored in my Personal.xls workbook. I would like to create a master macro or some code that would take macro A, B, C, D...etc. and sequentially execute them. I've done this in access but can't seem to find the equivalent statements for Excel.
 
it used to be something like...

application.run macro:="macro_name"
 
Sub globalMarcoStart()

Call module1.Macro1()
Call module2.Macro2()

End Sub

'or am i silly and macros are things other than Sub's or functions?
 
nope - and if they are in the same module, it is even easier than that eg
Code:
Sub First_Sub()
msgbox "Running 1st sub"
End sub

Sub Second_Sub(passVar as integer)
msgbox "Hello Number " & passVar
End sub

Sub Run_All()
First_Sub
Second_Sub(1)
End Sub

Rgds, Geoff

"Three things are certain: Death, taxes and lost data. Guess which has occurred"

Please read FAQ222-2244 before you ask a question
 
Thanks all.

I also got this to work using

Sub MainMacro ()
Call Macro1
Call Macro2

End Sub

Same as mrmovie shows. Thanks again
 
You only need the Call syntax if you want to force the use of named arguments...(ie the byRef as integer type things)

Rgds, Geoff

"Three things are certain: Death, taxes and lost data. Guess which has occurred"

Please read FAQ222-2244 before you ask a question
 
i didnt realise there was actually a point to the Call statement. i tend to use it just so i can see whats going on better, cheers for the tips
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top