Run subs in a specific order from another macro

tlc_in_OK

Board Regular
Joined
Jun 27, 2011
Messages
56
I have 9 private subs that need to be run in a specific order. I've called them in another macro "MainMacro()" and then run them from a button. But they seem to be "firing" in random order, even though the call statements are in the order I needed them. Is there something special that needs to be done to get them to run in order?

Code:
Public Sub MainMacro()
 Call CopyPivotInfo1
 Call CopyFunctionK
 Call CopyPivotInfo2
 Call CopyFunctionL
 Call CopyPivotInfo3
 Call CopyFunctionM
 Call CopyFunctionI
 Call CopyFunctionJ
 Call Macro9
 Call ShiftCellsDownK
End Sub
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
Well to be honest no. As far as I've ever known they should execute in that exact order.

Do any of the macros call each other?
 
Upvote 0
What do the subs do?

It's possible that whatever the end result is just appears to be caused by them running in a random order.
 
Upvote 0
All I can think is that I take it CopyPivotInfo procedures are doing something with pivot tables - could the procedures be referring to the wrong pivot tables at run time - not exactly sure how pivot table names are assigned if you don't specifically name each one. Could make it appear they're running in the incorrect order?

Hard to tell without seeing the code.
 
Upvote 0
My bad. . .you guys are correct, they DO run in exactly that order. I could run them in order and they worked perfectly, but MainMacro() will be run from a different worksheet, and I found a couple of bugs in my range references to the worksheet where the data is manipulated. Thanks for the input.
 
Upvote 0

Forum statistics

Threads
1,214,808
Messages
6,121,681
Members
449,048
Latest member
81jamesacct

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top