Please Note: This article is written for users of the following Microsoft Excel versions: 2007, 2010, and 2013. If you are using an earlier version (Excel 2003 or earlier), this tip may not work for you. For a version of this tip written specifically for earlier versions of Excel, click here: Turning Off Screen Updating.

Turning Off Screen Updating

by Allen Wyatt
(last updated January 10, 2017)

5

Many people write their own macros to manipulate the information in a workbook. Many times the macro may do quite a bit with the data, such as selecting different cells, replacing values or formulas, and taking other types of actions. This means that the Excel screen can look like it has "gone crazy" while the macro is running.

One thing you may want to do with your macro to make it run faster and to prevent distracting flashes on the screen is to turn off screen updating while the macro is running. The following macro lines will, respectively, turn off screen updating and then turn it back on in a VBA macro.

Application.ScreenUpdating = False
Application.ScreenUpdating = True

The idea is to use the first line near the beginning of your macro, and then use the second line near the end. Thus, the main body of your macro can do its work behind the scenes without the necessity of stopping to update the screen.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (9151) applies to Microsoft Excel 2007, 2010, and 2013. You can find a version of this tip for the older menu interface of Excel here: Turning Off Screen Updating.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He  is president of Sharon Parq Associates, a computer and publishing services company. ...

MORE FROM ALLEN

Understanding and Creating Lists

There are two types of common lists you can use in a document: bulleted lists and numbered lists. This tip explains the ...

Discover More

Understanding and Using Bookmarks

Bookmarks are a great feature you can use to mark the location of text or to mark a position within a document. They can be ...

Discover More

Smoothing Out Data Series

One way you can make your charts look more understandable is by removing the "jaggies" that are inherent to line charts. This ...

Discover More

Create Custom Apps with VBA! Discover how to extend the capabilities of Office 2013 (Word, Excel, PowerPoint, Outlook, and Access) with VBA programming, using it for writing macros, automating Office applications, and creating custom applications. Check out Mastering VBA for Office 2013 today!

More ExcelTips (ribbon)

Skipping Hidden Rows in a Macro

As your macro processes information in a worksheet, you may want to make sure that it skips over rows that are hidden. The ...

Discover More

Deriving an Absolute Value in a Macro

Need to figure out an absolute value within your macro code? It's easy to do using the Abs function, described in this tip.

Discover More

Pausing Macros for User Input

Does your macro need to get some input from a user? Here are the ways that Excel provides for that input to be solicited.

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.

Comments

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] in your comment text. You’ll be prompted to upload your image when you submit the comment. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is eight minus 8?

2017-01-10 10:19:20

Dave Bonin

I've written several macro programs that take a while to execute. Some are for my use and some for use by many. This is my good practice...

Tell the user what's going on and provide an indication of progress, ideally every three to ten seconds.

For example, one program I alone use takes about 40 seconds to execute across 12 similar sheets. In that case, I update the status bar message every time the code starts on the next sheet. I also momentarily turn screen updating on and then off again to show each sheet as it processes. Much better than staring at an unchanging screen for 40 seconds (that would be like watching the microwave for 40 seconds -- it takes forever).

Another program for others runs through about 25 steps. For that, I post and update a userform for each step with a text message with the elapsed time, the number and name of each step, and a progress bar. It shows the user that progress is being made. Also, if the program quits, a screen snapshot tells me where the macros quit working on that user's computer.


2017-01-10 09:48:15

Wim Torfs

There is one thing to be aware of. Don't use "Exit Sub", instead use "GoTo EndOfMacro" and place this code before "End Sub".
EndOfMacro:
Application.ScreenUpdating = True
The same goes for all you do with "Application.***"


2015-10-08 07:32:13

Petr Pechacek

Note: Windows 8+, Excel 2010+, use DoEvents for updating StatusBar with ScreenUpdating = False.


2014-02-17 09:34:57

Spence Wikel

A simple and less involved method of providing progress updates would be to use the following line of code in the macro:
Application.StatusBar = "Processing... Please Be Patient."
The Application.StatusBar text can be updated with anything throughout the macro - plain text, calculated completion precentages, elapsed time, etc.
Prior to "End Sub", place this last line of code:
Application.StatusBar = False
[Note: Even if Application.ScreenUpdating = False, the statusbar will change.]


2014-02-17 09:07:49

Barry Fitzpatrick

This does the side effect that it looks as though Excel has "hung" or crashed, especially if the macros is going to take some time to execute.

For long macros I would advocate displaying a Userform saying "Please Wait" and for very long macros showing a progress bar or percentage complete, and maybe even a "Cancel" button to exit before completion.


This Site

Got a version of Excel that uses the ribbon interface (Excel 2007 or later)? This site is for you! If you use an earlier version of Excel, visit our ExcelTips site focusing on the menu interface.

Newest Tips
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.