MyFirstMacro
New Member
- Joined
- Apr 26, 2011
- Messages
- 3
I have several macros that I want to run with one macro. I have tried all of the following:
Sub Main()
Call Macro1
Call Macro2
Call Macro3
End Sub
Sub Main2()
Macro1
Macro2
Macro3
End Sub
Sub Main3()
Application.Run "'WorkbookName'!Macro1"
Application.Run "'WorkbookName'!Macro2"
Application.Run "'WorkbookName'!Macro3"
End Sub
Sub Main4()
If Range("$C$2").Value<>OldVal Then
Call Macro1
End If
If Range("$C$3").Value<>OldVal Then
Call Macro2
End If
If Range("$C$4").Value<>OldVal Then
Call Macro3
End If
End Sub
(The 4th one is supposed to run the macros only if their respective cell values change, I don't really care about this option but I'm just trying everything.)
In ALL 4 cases, the "Main" macro only runs Macro1 and then stops. I know that my submacros are right (Macro1, Macro2, Macro3) because I have tested them all separately. And, if I switch the order around in Main (to run Macro2, then Macro3, then Macro1) it runs Macro2 only and then stops.
How do I make it run all the macros???
As my username indicates, this is my first time ever writing macros from scratch. While I think I've learned a lot since yesterday afternoon, please assume I know nothing.
Thank you!!!
Sub Main()
Call Macro1
Call Macro2
Call Macro3
End Sub
Sub Main2()
Macro1
Macro2
Macro3
End Sub
Sub Main3()
Application.Run "'WorkbookName'!Macro1"
Application.Run "'WorkbookName'!Macro2"
Application.Run "'WorkbookName'!Macro3"
End Sub
Sub Main4()
If Range("$C$2").Value<>OldVal Then
Call Macro1
End If
If Range("$C$3").Value<>OldVal Then
Call Macro2
End If
If Range("$C$4").Value<>OldVal Then
Call Macro3
End If
End Sub
(The 4th one is supposed to run the macros only if their respective cell values change, I don't really care about this option but I'm just trying everything.)
In ALL 4 cases, the "Main" macro only runs Macro1 and then stops. I know that my submacros are right (Macro1, Macro2, Macro3) because I have tested them all separately. And, if I switch the order around in Main (to run Macro2, then Macro3, then Macro1) it runs Macro2 only and then stops.
How do I make it run all the macros???
As my username indicates, this is my first time ever writing macros from scratch. While I think I've learned a lot since yesterday afternoon, please assume I know nothing.
Thank you!!!