VBA code to make a progress tool bar work

  • Thread starter Thread starter Jeff Marshall
  • Start date Start date
J

Jeff Marshall

Hi,
Does anyone have some code that would make a progress tool bar work in a
UserForm1.
I would like to use it in a For loop where it shows the status of the
variable C.

For example;

For C = 1 to 25000
'Code goes here

UserForm1 goes here with progess bar in it showing the % complete as C goes
from 1 to 25000.

Next C

Thanks
Jeff
 
Userform1.show vbModeless
Userform1.ProgressBar1.Value = 0
For C = 1 to 25000
'Code goes here

With Userform1.ProgressBar1
.value = c/25000 * (.max - .min)
Doevents
End With

Next C

Unload Userform1
 
Jeff,

John Walkenbach has a nice example on his site at
http://j-walk.com/ss/excel/tips/tip34.htm.

The thing to note is that you have to control it. You have to know how to
determine progress so that you can call the progressbar routine. Taking a
simplistic example, if you have a loop that executes 250 times, every 25
cycles you call the progressbar incrementing by 10%.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
Back
Top