![]() |
Macro to run Command Buttons
Hi
I have 13 individual macros assigned to 13 individual command buttons on 13 separate sheets. I would like one more command button with a macro that runs all of the other 13 macros/buttons. thanks Leigh |
Macro to run Command Buttons
create the following procedure in a module:
sub RunAllMacros call Macro1 call Macro2 .... call Macro 13 end sub create the new command button and assign the macro "RunAllMacros" to it. Sam "Leigh Douglass" wrote: Hi I have 13 individual macros assigned to 13 individual command buttons on 13 separate sheets. I would like one more command button with a macro that runs all of the other 13 macros/buttons. thanks Leigh |
Macro to run Command Buttons
Just to add on.... please make sure sheets are refered properly within your
macro like Sheets("Sheename"). and not as ActiveSheet. or ActiveCell. If this post helps click Yes --------------- Jacob Skaria "Leigh Douglass" wrote: Hi I have 13 individual macros assigned to 13 individual command buttons on 13 separate sheets. I would like one more command button with a macro that runs all of the other 13 macros/buttons. thanks Leigh |
Macro to run Command Buttons
You will need to insert a Call at the end of each sub.
Like this: Call mysub() Remember, VBA executes in linear fashion, so call the second sub from the first, call the third sub from the second, etc. HTH, Ryan--- -- Ryan--- If this information was helpful, please indicate this by clicking ''Yes''. "Leigh Douglass" wrote: Hi I have 13 individual macros assigned to 13 individual command buttons on 13 separate sheets. I would like one more command button with a macro that runs all of the other 13 macros/buttons. thanks Leigh |
Macro to run Command Buttons
Leigh
Something like the following in the code module for the sheet with the button that runs all 13 should work: Option Explicit Private Sub CommandButton1_Click() MsgBox "test 1" End Sub Private Sub CommandButton3_Click() Call CommandButton1_Click Call Sheet2.CommandButton1_Click Call Sheet3.CommandButton1_Click End Sub You need to make sure the commond button procedures on the sheets other than the calling sheet are not Private. Good luck. Ken Norfolk, Va On May 28, 9:53*am, Leigh Douglass wrote: Hi I have 13 individual macros assigned to 13 individual command buttons on 13 separate sheets. *I would like one more command button with a macro that runs all of the other 13 macros/buttons. thanks Leigh |
All times are GMT +1. The time now is 12:19 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com