application.statusbar fails to update

baitmaster

Well-known Member
Joined
Mar 12, 2009
Messages
2,039
I regularly use application.statusbar to report my progress through long complex loops of code

On most occasions, it gets to a point and then stops reporting: it will stop and just say e.g. "progress = 5%". The macro is continuing in the background, and hitting escape can be enough to force the statusbar to update again - but this can also interrupt the routine

What can I do to keep the statusbar updating correctly?

thanks
 

Some videos you may like

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.

BrianExcel

Well-known Member
Joined
Apr 21, 2010
Messages
969
It's hard to tell without seeing your code, but my first suggestion would be making sure the code to update the status bar is in the right location(s).
 

baitmaster

Well-known Member
Joined
Mar 12, 2009
Messages
2,039
Thanks Brian

The code itself is any loop containing this code. e.g.
Code:
totalCells = rng.cells.count
for each cl in rng
    thisCount = thisCount + 1
    application.statusbar = format(thisCount/totalCells,"0.0%")
    ' a series of other calculations and algorithm steps here
next cl

Some of the algorithms I create are quite complex, and may require fairly heavy calculations. I think there is also correllation between switching calculations off and the statusbar failing to update (after a certain point; it updates for the first few seconds, sometimes all the way through)

The issue is simply that, although the calculations and algorithms continue, the statusbar stops updating. I'm wondering if adding a very slight delay is the answer, as maybe it allows the statusbar to "catch up" - but I don't want to slow my code down
 

Watch MrExcel Video

Forum statistics

Threads
1,123,318
Messages
5,600,918
Members
414,416
Latest member
Nobu

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
Top