ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   VBA code to make a progress tool bar work (https://www.excelbanter.com/excel-programming/279334-vba-code-make-progress-tool-bar-work.html)

Jeff Marshall

VBA code to make a progress tool bar work
 
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




Tom Ogilvy

VBA code to make a progress tool bar work
 
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

--
Regards,
Tom Ogilvy



Jeff Marshall wrote in message
...
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






Bob Phillips[_5_]

VBA code to make a progress tool bar work
 
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)

"Jeff Marshall" wrote in message
...
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







All times are GMT +1. The time now is 05:47 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com