ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Code running order (https://www.excelbanter.com/excel-programming/340079-code-running-order.html)

Santiago[_3_]

Code running order
 
Hi guys,

I'm quite new on this so probably this is too easy...
how can I make some Subs run in order but winting for the previous one to
finish what it is doing? for example:

call SUB1
call SUB2
call SUB3

I want each sub to start when the last one finishes executing. is this
possible?

I could put the "call SUB2" inside SUB1 (at the end) and that would maybe
solve it, but not in all cases...

Thanks & Bregards

Santiago

JNW

Code running order
 
Try:

Sub master()
call sub1
end sub

sub sub1()
...code...
call sub2
end sub

etc.....

"Santiago" wrote:

Hi guys,

I'm quite new on this so probably this is too easy...
how can I make some Subs run in order but winting for the previous one to
finish what it is doing? for example:

call SUB1
call SUB2
call SUB3

I want each sub to start when the last one finishes executing. is this
possible?

I could put the "call SUB2" inside SUB1 (at the end) and that would maybe
solve it, but not in all cases...

Thanks & Bregards

Santiago


Fred[_21_]

Code running order
 
I do this exact thing with about 25 subs.

I simply have a master sub like JNW sugested but I just list all my
subs in it:

Sub master()
Call sub1
Call sub2
Call sub3
Call sub4
etc..
End Sub

After Sub1 runs control is returned to the master sub which then
executes Sub2, Sub2 runs and then control goes back to master which
then exucutes Sub3 and so on.

Fred



All times are GMT +1. The time now is 02:43 PM.

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