Please Note: This article is written for users of the following Microsoft Excel versions: 2007, 2010, 2013, 2016, 2019, and Excel in Microsoft 365. 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: Running Macros in the Background.

Running Macros in the Background

Written by Allen Wyatt (last updated December 19, 2020)
This tip applies to Excel 2007, 2010, 2013, 2016, 2019, and Excel in Microsoft 365


1

When you run a macro in Excel, the program turns its full attention to completing the macro. (Sounds almost anthropomorphic, doesn't it?) This means that if the macro does quite a bit of heavy-duty processing of your data, it can seem as if your system has "locked up" during the processing of the macro.

Rest assured that the macro processing is only affecting Excel, however. You can open a different application and work within it while the macro chunks away in Excel in the background. Of course, the attention being paid to the macro by your system will probably slow down the response of the other program, but this depends on the version of Windows you are using on your system. The reason? Sharing of resources requires a process known as multitasking. Different versions of Windows handle multitasking in different ways.

You may wonder how you can do other work in Excel while the program is busy running a macro. Easy—just open another instance of Excel (run it again from your Start menu) and do some other work. All you need to do is make sure that you don't try to work on the same workbook (or workbooks) being utilized by the macros in your first instance of Excel.

Another way to do a bit of work is to modify your macro just a bit. Chances are good that if your macro is running for a long period, it is due to it executing a loop of some type. By adding within the loop the DoEvents command, the macro will suspend execution temporarily and hand back control to the user's processes. So if you've pressed a key, clicked the mouse, or started to type something, DoEvents takes notice and performs whatever tasks are required to handle what you want done. When all user input has been serviced, the macro continues happily on its way.

Adding DoEvents slows down your macro somewhat, but it does allow you to continue working a bit. (Understand that Excel will still be sluggish; your macro does take resources to run.) Adding DoEvents can also provide an opportunity to break out of the macro (using Ctrl+Break) in a controlled manner.

Remember, though, that you can only figure out what works best in your situation by testing (and more testing).

Note:

If you would like to know how to use the macros described on this page (or on any other page on the ExcelTips sites), I've prepared a special page that includes helpful information. Click here to open that special page in a new browser tab.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (8971) applies to Microsoft Excel 2007, 2010, 2013, 2016, 2019, and Excel in Microsoft 365. You can find a version of this tip for the older menu interface of Excel here: Running Macros in the Background.

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

Last-Row Border Formatting

How to make the border on the last row on a page look right.

Discover More

Changing Gridline Color

Gridlines are very helpful in seeing where cells are located on the screen. You are not limited to black gridlines; ...

Discover More

Counting Asterisks

For some operations and functions, Excel allows you to use wild card characters. One such character is an asterisk. What ...

Discover More

Save Time and Supercharge Excel! Automate virtually any routine task and save yourself hours, days, maybe even weeks. Then, learn how to make Excel do things you thought were simply impossible! Mastering advanced Excel macros has never been easier. Check out Excel 2010 VBA and Macros today!

More ExcelTips (ribbon)

Worksheet Events

You can create macros that are automatically executed whenever certain events occur within a worksheet. This tip details ...

Discover More

Generating a List of Macros

Got a workbook that has lots and lots of macros associated with it? Here's a way you can get a list of all of those ...

Discover More

Executing a Macro Every 15 Minutes

Need to run a macro at a given interval? It's easy to do when you learn how to use the .OnTime method, described in this tip.

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}] (all 7 characters, in the sequence shown) in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. 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 four minus 0?

2020-12-20 03:07:23

Philip

Note : running multiple instances of Excel (or any app) on a Mac is NOT possible ...


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.