VBA – Turn off Screen Updating

Associated Files Download Links

As cool as it looks watching your VBA macro manipulate the screen, you can help your Macro run faster if you turn off (disable) ScreenUpdating. 

Disable ScreenUpdating

1. To disable ScreenUpdating, At the beginning of your code put this line:

Enable ScreenUpdating

2. To re-enable ScreenUpdating, At the end of your code put this line:

VBA ScreenUpdating Example

Your procedure will then look like this:

vba screen updating

ScreenUpdating Refresh

Disabling ScreenUpdating will make your VBA code run MUCH faster, but it will also make your work appear more professional. End-users typically don’t want to see the behind the scenes actions of your procedures (especially when the procedure runs slow). Also, you may not want end-users to see the behind the scenes functionality (ex. Hidden Worksheets). I recommend disabling (and re-enabling) ScreenUpdating in virtually all of your procedures.

However, there are some times when you want the screen to refresh. To refresh the screen, you will need to temporarily turn back on ScreenUpdating (there is no screen “refresh” command):

VBA Settings – Speed Up Code

There are several other settings to play with to improve your code speed.

Disabling Automatic Calculations can make a HUGE difference in speed:

Disabling the Status Bar will also make a small difference:

If your workbook contains events you should usually disable events at the beginning of your procedure:

Last, your VBA code can be slowed down when Excel tries to re-calculate page breaks (Note: not all procedures will be impacted).  To disable displaying page breaks use this line of code:

VBA Coding Made Easy

Stop searching for VBA code online. Learn more about AutoMacro – A VBA Code Builder that allows beginners to code procedures from scratch with minimal coding knowledge and with many time-saving features for all users!

VBA Turn Off On ScreenUpdating

 


<<Return to VBA Examples

Did you find this VBA tutorial useful? Then share it with your friends and colleagues:

You may also like some of this related content...

Display Fullscreen You can launch Excel to display fullscreen using VBA by using this line
Hide Excel There may occasionally arise a need to hide all of excel, a good
ActiveWindow.Zoom You can use VBA to change the Zoom of a worksheet. Here's code to
Fit Selection In a Worksheet you can use View->Zoom->Fit Selection to automatically adjust the Zoom
Page Break Preview Mode To place Sheet1 in Page Break Preview View from code: Sheet1.Activate
Advertisements
Automate Excel
Left Menu Icon