10. VBA Tips - Update Statusbar
This VBA tip is for people designing systems in Excel:
- You've written some code that takes a while to run
- You don't want your users to think nothing is happening
- This tip shows you how to update them on the code's progress
The example we will use is that of changing a cell's value from 1 to 1000.
Here's a screen shot of our data in Excel, and our VBA code:
Explanation:
- At the start of the code, we tell users we are "processing"
- We then enter a loop, and at each iteration we update where we are
- At the end of the code, we say that we've finished
- The updates appear on the statusbar which is under "sheet1" tab
Download sheet to practise how to Update Statusbar in VBA
Training Video on how to Update Statusbar in VBA:
Attachment | Size |
---|---|
update-statusbar.xls | 31 KB |
»
- Nick's blog
- Login or register to post comments
- 56977 reads
THE CODE IN MY PC RUN VERY SLOWLY
SAMPLE TEST FILE ON MY PC. WHY? THE CODE IN MY PC RUN VERY SLOWLY?
slow code
most likely, you have other sheets open, and calculation on automatic
turn to manual
Updating the statusbar
I have found that some times the sheer number of iterations can be a distraction if the status bar updates each time.