Thread: Progress Bar
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Ivyleaf Ivyleaf is offline
external usenet poster
 
Posts: 141
Default Progress Bar

On Apr 4, 3:53*pm, Jeff wrote:
Hi -
I have a macro that takes quite some time. *There are several loops that run
inside of it to delete or consolidate rows (which can be up to 40,000 rows). *
The macro can take about 20 seconds to 1.5 minutes. *I would like to create a
Progress Bar to let the user know that how long to expect (and that the macro
is actually running...). *I have viewed the websitehttp://www.enhanceddatasystems.com/ED/Pages/ExcelProgressBar.htm, but I do
quite understand how to incorporate this into my macro.

If anyone has any suggestions, I would really appreciate it. *

Thank you in advance.
--
Jeff


Hi Jeff,

If you can place your loop code, or at least an abbreviated version it
would probably make it easier to suggest the best method. Also, have
you considered just using a statusbar notification? Even 1.5min isn't
rediculously long, and as a user as long as I had some sort of
indication that things were still ticknig along I would be happy. I'd
be reluctant to slow things down too much more by adding even more
code such as a form with a progressbar etc. Different if it was a 2
hour peocess... then the overhead of the progressbar would be
negligible in effect compared to the overall run if you know what I
mean.

Here is some code for a StatusBar progress message:

Sub StatusText()
Dim i As Long, Target As Long

Target = 1000000
For i = 1 To Target
If i * 100 Mod Target = 0 Then
Application.StatusBar = i * 100 _
/ Target & "% Complete"
End If
DoEvents
Next
Beep
Application.StatusBar = False

End Sub