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: Working while a Macro is Running.

Working while a Macro is Running

by Allen Wyatt
(last updated August 8, 2015)

3

Macros are great for doing the mundane (or not so mundane) processing that is often necessary with Excel data. After you start to use them, you may find that running macros can consume quite a bit of time. While you are running them, there is very little else that you can do, since Excel won't allow you to do any other work while the macro is chunking away.

The best way to do additional work is to open another instance of Excel. As you are working on one workbook in the foreground, the other instance of Excel continues to work away at the macro in the background. This approach works because Windows allows multiple instances of a program, each in its own workspace. The only thing you cannot do is work in the foreground on the same workbook which the macro is using.

In order to open a second instance of Excel, simply follow the steps you followed to open the first instance. For example, if you started Excel by calling up the Start menu and then the Programs submenu, you could do the same thing to open the second instance.

You should realize that the macro running in the background instance of Excel will be affected by you working on a different instance of Excel in the foreground. This, again, is related to how Windows treats different programs. On most systems, the background programs are given a smaller percentage of the CPU's attention than the foreground program.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (11031) applies to Microsoft Excel 2007, 2010, and 2013. You can find a version of this tip for the older menu interface of Excel here: Working while a Macro is Running.

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

Cross-Referencing to Line Numbers

Wouldn't it be nice to be able to do cross-referencing to line numbers within a document? Word doesn't have a built in way to ...

Discover More

Shortcut to Merge Cells

Need to merge a bunch of cells together on a regular basis? You'll love the two macros in this tip which can make short work ...

Discover More

Updating Many Template References

Documents rely on templates. If you change the location of those templates (on purpose or by accident), Word can take a very ...

Discover More

Solve Real Business Problems Master business modeling and analysis techniques with Excel and transform data into bottom-line results. This hands-on, scenario-focused guide shows you how to use the latest Excel tools to integrate data from multiple tables. Check out Microsoft Excel 2013 Data Analysis and Business Modeling today!

More ExcelTips (ribbon)

Adjusting a Path Based on System and User

It is not uncommon to set variables in a macro based on other values, such as time or date. You could also set variables ...

Discover More

Understanding the While...Wend Structure

Logical structures are important in programming, as they allow you to control how the programming statements are executed. ...

Discover More

Separating Evens and Odds

If you have a series of values in a column, you might have a need to separate the values into even values and odd values. ...

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. 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 7 + 6?

2017-09-18 03:18:19

Barry

@Simonkonde
The solution depends on what version of Excel you are using and also if other people are using the workbook with the macros in them (and the macros are needed for them as well).

Excel itself must have its security settings set to allow macros to run (this is covered elsewhere in another Tip https://excelribbon.tips.net/T011194_Disabled_Macros.html ). I would on newer versions of Excel set u a "trusted" location and store the workbook there. Thirdly, digitally signing an application will allow a higher security setting to be used.


2017-09-17 14:38:02

Simukonde Moses

Thank you for the tips, my request is most of the time i open the macros, they are disabled and every time i have to anable. how can i make it enabled permanently like other computers


2016-09-22 08:10:27

Barry

It is perfectly possible to work on a workbook with a macro also running. To do this you need to place a "DoEvents" command in an inner loop that is frequently called from the macro that is running in "background".

The DoEvents allows Excel to process User inputs. It is important that this command is called frequently otherwise Excel will become very unresponsive. Obviously is takes time to process the User inputs so this can slow down the macro even when there are no User inputs to process (it takes time just to check if there are any inputs to process).

The other thing to be borne in mind is if the macro is operating on the user inputted values, so there can be a "clash" between what the User is trying to and what the macro is trying to do. This can be quite disconcerting if the User does know what is going on.


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.