VBA Calling Subs - Efficient?

Nysius

New Member
Joined
Nov 27, 2015
Messages
1
Hi Everyone,

Not sure if this can be answered easily but here it goes:

I've created a module in VBA where I've placed a sub macro containing:

Sub BG_UpdatingOFF()
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
End Sub


Sub BG_UpdatingON()
Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = True
End Sub

I then 'Call' these macros in my form scripts etc. My question: Is it more efficient to just write these lines in the particular form/module code or am I still being efficient by calling the functions? What is the preferred "best practice" way of doing this?

Thanks for the help!
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
Seems an unusual way to do what those subroutines do, but calling subroutines is not necessarily inefficient. Unless you notice some degradation in speed of execution using these subs, why be concerned about it?
 
Upvote 0
Hi,

I don't know if there is any significant performance difference between either way; however, if you have a lot of "Subs" or codes that require UpdatingOn and UpdatingOff, it just makes it easier to Call these in your Subs than to type them over and over again.
 
Upvote 0

Forum statistics

Threads
1,215,029
Messages
6,122,757
Members
449,094
Latest member
dsharae57

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