Sub Calling Sub Best Practices

Automate_It

New Member
Joined
Jun 27, 2018
Messages
2
I'm curious what the community has to say about this:

Which option would be considered Best Practice for calling multiple subs? Aside from speed, which I'm not overly concerned about, does one have an advantage over the other? Why?

Option A:

Code:
Sub CallingAllSubs()

   Call Sub2
   Call Sub3
   Call Sub4
   Call Sub5

End Sub

Option B:

Code:
Sub CallOneSub()

   Call Sub2
   Call Sub3

End Sub

Sub Sub3()

   Call Sub4
   Call Sub5

End Sub
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
Generally there is NO difference.

If your situation doesn't really demand "Option B" I would suggest always go for option A. ( why you give two button if one button does your job).
 
Upvote 0
Thanks MUKESHY,

I guess it wasn't the best example. It should have been more like this:

Code:
Sub Sub1()

   Call Sub2
   Call Sub3

End Sub

Sub Sub4()

   Call Sub5
   Call Sub6

End Sub


I've used the example above when I have a conditional statement where I may need user input. I guess I just find it easier to isolate & work with while testing.
 
Upvote 0

Forum statistics

Threads
1,215,425
Messages
6,124,825
Members
449,190
Latest member
rscraig11

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