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!
 

Some videos you may like

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.

JoeMo

MrExcel MVP
Joined
May 26, 2009
Messages
17,388
Office Version
  1. 365
  2. 2010
Platform
  1. Windows
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?
 

jtakw

Well-known Member
Joined
Jun 29, 2014
Messages
5,394
Office Version
  1. 2016
Platform
  1. Windows
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.
 

Watch MrExcel Video

Forum statistics

Threads
1,122,762
Messages
5,597,977
Members
414,198
Latest member
Chadchi

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
Top