Return to VBA Code Examples

VBA – Turn off Screen Updating

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