Hi All
I have been playing around with the status bar for some longer macros - some are OK as I can just change the status bar along the code, however am stuck when it comes to loops.
The loops are what take the longest and when a lot of people I work with think Excel has crashed - when it hasn't - then they start jabbing buttons and things go wrong. So, one of the loops I use is:
Dim c As Range
Dim SrchRng
Set SrchRng = ActiveSheet.UsedRange
Do
Set c = SrchRng.Find("Delete", LookIn:=xlValues)
If Not c Is Nothing Then c.EntireRow.Delete
Loop While Not c Is Nothing
I have found a few codes to update the lines etc, however when I have tried to update this code, I have done something wrong.
For instance, with this code:
Dim x As Integer
Dim MyTimer As Double
'Change this loop as needed.
For x = 1 To 50
' Do stuff
Application.StatusBar = "Progress: " & x & " of 50: " & Format(x / 50, "0%")
Next x
Application.StatusBar = False
How would I look to incoperate it, so that each time the loop does one occurance it updates the status bar?
Another query - if I have a macro that I know takes a certain amount of time, ie 5 minutes, is there a way to put, into a loop, a timer so it counts down from 5 mins, or to 5 mins or something similar?
Bookmarks