Using a Progress Indicator in Macros

Written by Allen Wyatt (last updated July 1, 2022)
This tip applies to Excel 97, 2000, 2002, and 2003


2

The macro language (VBA) provided with Excel is quite powerful. This means that you can do some pretty intense (and impressive) tasks with the language. Some tasks might take quite a while to complete. The problem is that some users may think their computer has hung unless there is some on-screen indication that the macro is running.

There are two ways that you can approach a solution to such a task. The first (and simplest) option is to use the status bar to indicate the progress of your macro. For instance, you could add some code to your macro by which it determines the percentage of completion. Once you have a percentage in hand (let's say it is stored in the xPctComp variable), you simply add the following line to your macro:

Application.StatusBar = "Portion completed: " & _
  Format(xPctComp, "##0.00%")

Such a line could be added within the main body of your macro, for instance within whatever loop you have that controls processing. When the macro is just about done, you should add a line that clears the status bar, such as the following:

Application.StatusBar = ""

The other way to create a progress indicator is to use some sort of a dialog box that displays a "fuel gauge" indicator as to the percentage complete. There are numerous implementations of such a concept already available on the Web. A good representative of this approach is found at John Walkenbach's site:

http://www.j-walk.com/ss/excel/tips/tip34.htm

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 (2496) applies to Microsoft Excel 97, 2000, 2002, and 2003.

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 Footnotes and Endnotes

Footnotes and endnotes are often used in scholarly and formal writing as a way to provide additional information about a ...

Discover More

Modifying the Backup Copy File Name

Backup files, created automatically by Word, have the filename extension WBK and start with the words "Backup of." If you ...

Discover More

Searching for Text with a Certain Format

The Find and Replace tool in Word is very powerful. You can use it to search not only for text but for the formatting ...

Discover More

Excel Smarts for Beginners! Featuring the friendly and trusted For Dummies style, this popular guide shows beginners how to get up and running with Excel while also helping more experienced users get comfortable with the newest features. Check out Excel 2013 For Dummies today!

More ExcelTips (menu)

Checking if a Workbook is Already Open

Knowing of a workbook is already open can be a prerequisite to your macro working correctly. Here's how to check it out.

Discover More

Turning Off Screen Updating

Want a quick way to speed up your macros? All you need to do is to stop Excel from updating the screen while the macro is ...

Discover More

Displaying the Print Dialog Box in a Macro

Want to print a document by using a macro? One way is to display the Print dialog box and allow the user to interact with ...

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 1 + 1?

2017-12-30 10:01:21

Barry

@Roy

Try http://spreadsheetpage.com/index.php/tip/displaying_a_progress_indicator/


2017-12-30 07:57:06

Roy Taylor

Allen,

I have been trying to produce a progress bar but to no avail so the J-walk sounded perfect, but I keep getting "this page cant be displayed" message.

Does it still exist?

Roy


This Site

Got a version of Excel that uses the menu interface (Excel 97, Excel 2000, Excel 2002, or Excel 2003)? This site is for you! If you use a later version of Excel, visit our ExcelTips site focusing on the ribbon 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.