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

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
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,218,692
Messages
6,143,944
Members
450,517
Latest member
Rovex

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