j-walk progressbar mod question

G

Guest

been playing with the progressbar form j-walk.com. Some loops cycle through over 4000 items, and the analysis time for this using the progressbar had increased by >10x - which of course is not surprising - but is a very nice indicator that things are actually progressing... Can anyone suggest a modification that will only get the progressbar to update itself as given increments are reached - maybe either at every 20th iteration etc - that way could find a nice compromise between some slowing of analysis and visual aid. Is there a function that would be "true" if the value of 'i' was an exact multiple of 10 etc ??
Many thanks in advance.

For i = 1 to 1000
PctDone = i / 1000
With UserForm1
.FrameProgress.Caption = Format(PctDone, "0%")
.LabelProgress.Width = PctDone * (.FrameProgress.Width - 10)
End With
DoEvents
Next i
 
R

RB Smissaert

You could do something like this:

For i = 1 To 1000
If i Mod 20 = 0 Then
PctDone = i / 1000
With UserForm1
.FrameProgress.Caption = Format(PctDone, "0%")
.LabelProgress.Width = PctDone * (.FrameProgress.Width - 10)
End With
DoEvents
End If
Next i

RBS


Mike Iacovou said:
been playing with the progressbar form j-walk.com. Some loops cycle
through over 4000 items, and the analysis time for this using the
progressbar had increased by >10x - which of course is not surprising - but
is a very nice indicator that things are actually progressing... Can anyone
suggest a modification that will only get the progressbar to update itself
as given increments are reached - maybe either at every 20th iteration etc -
that way could find a nice compromise between some slowing of analysis and
visual aid. Is there a function that would be "true" if the value of 'i' was
an exact multiple of 10 etc ??
 
P

pfsardella

If i Mod 10 = 0 Then
' Perform the form update
End If

I use the Statusbar to display results instead of a Progressbar.

HTH
Paul
 
G

Guest

MOD - thanks. knew there what be - should have remembered to try looking this up from my BBC Micro basic programming days !!!!
I was using statusbar updates, but decided things looked cluttered and hid the excel application... could do similar by dynamically updating a userform label with just text... i'll see the sped trade-off.

Thanks for all help ;)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Stop looping macro 1

Top