ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Run several macros in a row (https://www.excelbanter.com/excel-programming/342357-run-several-macros-row.html)

Ctech[_20_]

Run several macros in a row
 

I have made 15 different macroes, which is part of a report macro.


I want the Userform OK button, to start the macro and then run through
all the macroes.

however my problem now is that the macro stops after the first End
Sub.
Is there a way to tell the macro to start directly on the next "Sub
macro2 ()" .



Thanks


--
Ctech
------------------------------------------------------------------------
Ctech's Profile: http://www.excelforum.com/member.php...o&userid=27745
View this thread: http://www.excelforum.com/showthread...hreadid=474743


Dave Peterson

Run several macros in a row
 
Have the ok button run all your macros:

sub commandbutton1_click()
call macro1
call macro2
call macro3
end sub



Ctech wrote:

I have made 15 different macroes, which is part of a report macro.

I want the Userform OK button, to start the macro and then run through
all the macroes.

however my problem now is that the macro stops after the first End
Sub.
Is there a way to tell the macro to start directly on the next "Sub
macro2 ()" .

Thanks

--
Ctech
------------------------------------------------------------------------
Ctech's Profile: http://www.excelforum.com/member.php...o&userid=27745
View this thread: http://www.excelforum.com/showthread...hreadid=474743


--

Dave Peterson

Vacation's Over

Run several macros in a row
 
Set OK button to Use a Macro(StartAllMacros) to call all other Macros
(Macro1, Macro2...)

sub StartAllMacros()
macro1
macro2
macro3
....
end sub

"Ctech" wrote:


I have made 15 different macroes, which is part of a report macro.


I want the Userform OK button, to start the macro and then run through
all the macroes.

however my problem now is that the macro stops after the first End
Sub.
Is there a way to tell the macro to start directly on the next "Sub
macro2 ()" .



Thanks


--
Ctech
------------------------------------------------------------------------
Ctech's Profile: http://www.excelforum.com/member.php...o&userid=27745
View this thread: http://www.excelforum.com/showthread...hreadid=474743



tad_wegner[_7_]

Run several macros in a row
 

to run several macros inside another macro use the "call" command

EXAMPLE: the names of your recorded macros are "recorded_macro1" &
"recorded_macro2"

sub main()

call recorded_macro1
call recorded_macro2

end sub

i hope this helps. i dont use userforms so i am not sure if this will
work. good luck.


--
tad_wegner
------------------------------------------------------------------------
tad_wegner's Profile: http://www.excelforum.com/member.php...o&userid=27770
View this thread: http://www.excelforum.com/showthread...hreadid=474743


Tom Ogilvy

Run several macros in a row
 
Private Sub Commandbutton1_click()
macro1
macro2
macro3
.. . .
macro14
macro15
end Sub

just call the macros sequentially.

--
Regards,
Tom Ogilvy

"Ctech" wrote in
message ...

I have made 15 different macroes, which is part of a report macro.


I want the Userform OK button, to start the macro and then run through
all the macroes.

however my problem now is that the macro stops after the first End
Sub.
Is there a way to tell the macro to start directly on the next "Sub
macro2 ()" .



Thanks


--
Ctech
------------------------------------------------------------------------
Ctech's Profile:

http://www.excelforum.com/member.php...o&userid=27745
View this thread: http://www.excelforum.com/showthread...hreadid=474743




Curt

Run several macros in a row
 
my macros are sub print xx()
end sub
will call "sub print xx" run the sub without more code
"Dave Peterson" wrote:

Have the ok button run all your macros:

sub commandbutton1_click()
call macro1
call macro2
call macro3
end sub



Ctech wrote:

I have made 15 different macroes, which is part of a report macro.

I want the Userform OK button, to start the macro and then run through
all the macroes.

however my problem now is that the macro stops after the first End
Sub.
Is there a way to tell the macro to start directly on the next "Sub
macro2 ()" .

Thanks

--
Ctech
------------------------------------------------------------------------
Ctech's Profile: http://www.excelforum.com/member.php...o&userid=27745
View this thread: http://www.excelforum.com/showthread...hreadid=474743


--

Dave Peterson


Curt

Run several macros in a row
 
What will this do when macros are sub end sub
being new this is confusing. have no macros named only sub()end sub

"tad_wegner" wrote:


to run several macros inside another macro use the "call" command

EXAMPLE: the names of your recorded macros are "recorded_macro1" &
"recorded_macro2"

sub main()

call recorded_macro1
call recorded_macro2

end sub

i hope this helps. i dont use userforms so i am not sure if this will
work. good luck.


--
tad_wegner
------------------------------------------------------------------------
tad_wegner's Profile: http://www.excelforum.com/member.php...o&userid=27770
View this thread: http://www.excelforum.com/showthread...hreadid=474743




All times are GMT +1. The time now is 12:22 AM.

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