Updating a cell during VBA execution

Mr930

Well-known Member
Joined
Aug 31, 2006
Messages
585
I have some lengthy VBA loops, and I am trying to display a counter in a cell. In each loop I have it place the counter in the cell. It works fine and updates as long as Excel has focus. However, if I go to another application, the cell is no longer updated, until the loop finishes and the Excel screen is updated.

Is there a way to have the cell be updated even if Excel loses focus?

thanks
Fred
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
I find the trouble with placing a counter in a cell is that you need Screenupdating set to True which, in most cases, will slow down the execution of the code.

I usually inform the user of the macros progress via the statusbar. As far as I know, this will continue to update even if Excel loses its focus (I could be wrong tho')
 
Upvote 0
e.g.

Application.Statusbar = "30% done"

At the end

Application.Statusbar = False
 
Upvote 0
How do you go about putting information in the status bar?

In terms of informing the user of the progress, I usually use a counter, e.g. (this would be within a Loop)

Code:
Application.StatusBar = "Finding policy " & n - 1 & " of " & End_Row - 1 & "..."

where n = row currently being processed, End_Row = end of data
 
Upvote 0

Forum statistics

Threads
1,214,893
Messages
6,122,121
Members
449,066
Latest member
Andyg666

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top