Excel Progress Bar while Calculating

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a pivot table in which I programmatically show/hide two variables
based on user input. This updates the pivot table and also about six other
worksheets which take about 4 minutes (that was the max I observed). During
this time, the status bar displays 'Calculating nn% done...'.

But I would also like to show a progress bar either as a userform or in the
status bar.
Is that possible? If so, how? How do I increment it and when do I stop,
since recalculation is not in my control.

Thanks a lot.
 
Have you considered writing to the status bar?

Application.StatusBar = "Completed task A starting task B"
 
Or something like this:


Sub StatusProgressBar(lCounter As Long, _
lMax As Long, _
lInterval, _
Optional strText As String)

Dim lStripes As Long

If lCounter Mod lInterval = 0 Or lCounter = lMax Then
lStripes = Round((lCounter / lMax) * 100, 0)
Application.StatusBar = strText & _
String(lStripes, "|") & _
String(100 - lStripes, ".") & "|"
End If

End Sub


RBS
 
Back
Top