
If the upper end of your loop is very large, then it might be better to calculate a percentage and update the status bar when some portion of the total is completed-perhaps every 5% or 10% of the total. The other thing to try is to simply not update the status bar as much.

You could even put the command right after updating the status bar:Īpplication.StatusBar = "Processing row " & X & " of " & Y This would, necessarily, let Windows know that Excel really is responsive and allow the updates to the status bar to occur. It is equivalent to forcing Excel to "look up" from the macro on which it is working and to communicate with Windows. Normally this is used to instruct the macro to pay attention to anything that is in the events queue, such as when someone presses the keyboard. First, you could use the DoEvents command within the loop. There are two possible approaches that can be used. Essentially, if Excel is busy performing the macro or it cannot keep up in asking Windows to update the status bar, then it does, indeed appear like Excel has stopped responding. (It is Windows, after all, that is responsible for what appears in a program's title bar.) I was able to reproduce the behavior quite easily if I have multiple programs open in Windows and I click to another program window while Excel is chunking through a long macro. This behavior seems to occur when it appears to Windows that Excel has stopped responding. Dave wonders how he can make Excel stop behaving in this manner and, instead, display the status bar updates like he wants.

The macro is still running, though, and when it completes, Excel starts responding and everything works like it should. Typically, he'll have a message displayed there such as "Processing row X of Y." When "Y" is a large value (the top end of the For.Next loop), Excel often stops updating the status bar and displays something like "Not Responding" in Excel's title bar. When Dave writes a macro that must process a lot of information in a For.Next loop, he always uses the status bar to indicate progress.
