ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   VB code to run multiple macro (https://www.excelbanter.com/excel-programming/406620-vbulletin-code-run-multiple-macro.html)

Cam

VB code to run multiple macro
 
Hello,

I have several macro that need to be ran once a button is click.
What VB code I put to tell it to run several macro?

Mike H

VB code to run multiple macro
 
You run the first macro then call the second from that i.e.

Sub Sonic()
'do something
mynextmacro
end sub


Sub mynextmacro()
'do something else
mythirdmacro
end sub

sub mythirdmacro()
etc

Mike


"Cam" wrote:

Hello,

I have several macro that need to be ran once a button is click.
What VB code I put to tell it to run several macro?


JLGWhiz

VB code to run multiple macro
 
To be more specific:

'Coce behind the command button

Private Sub CommandButton1_Click()
MainMacro
End Sub

'Code in standard code Module1

Sub MainMacro
Macro1name
Macro2name
Macro3name
...
Macronname
End Sub

"Cam" wrote:

Hello,

I have several macro that need to be ran once a button is click.
What VB code I put to tell it to run several macro?


JLGWhiz

VB code to run multiple macro
 
Typo!
Shoud be Sub MainMacro()

"JLGWhiz" wrote:

To be more specific:

'Coce behind the command button

Private Sub CommandButton1_Click()
MainMacro
End Sub

'Code in standard code Module1

Sub MainMacro
Macro1name
Macro2name
Macro3name
...
Macronname
End Sub

"Cam" wrote:

Hello,

I have several macro that need to be ran once a button is click.
What VB code I put to tell it to run several macro?



All times are GMT +1. The time now is 07:30 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com