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

Right-clicking for Synonyms

Learn the ins and outs of right-clicking on a word to learn its synonyms.

Discover More

Splitting Your Spreadsheet Window Into Panes

Need to keep different areas of the same worksheet in view at the same time? Excel makes this relatively easy through the ...

Discover More

Selecting Individual Cells in a Table

Many times, before applying formatting or doing another operation, you need to select an individual cell in a table. ...

Discover More

Comprehensive VBA Guide Visual Basic for Applications (VBA) is the language used for writing macros in all Office programs. This complete guide shows both professionals and novices how to master VBA in order to customize the entire Office suite for their needs. Check out Mastering VBA for Office 2010 today!

More ExcelTips (ribbon)

Checking the Scope of a Defined Name

When creating a macro to work with the names of defined ranges, you may need to know whether the scope of the name is for ...

Discover More

Determining an ANSI Value in a Macro

Need to know the character code used for a particular character? In a macro you can use the Asc function to determine the ...

Discover More

Selecting the First Cell In a Row

When creating macros, you'll often have a need to select different cells in the worksheet. Here's how to select the first ...

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 8 - 5?

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.