cjeb456
06-02-2008, 04:04 AM
Hi all,
I found a piece of code online that help me to setup a progress bar on an excel macro that takes a while to run.
I have a small problem with it though - the code uses the For and Next statements and repeats this a set number of times to fill the progress bar.
My code uses the Do While statement as I cannot be sure how many times the code needs to be looped - depends on the users spreadsheet.
The code in question is...
intMax = 100
For intIndex = 1 To intMax
sngPercent = intIndex / intMax
ProgressStyle1 sngPercent, chkPg1Value.Value
DoEvents
'My code goes here
Next
This will count from 1 to 100 and fills the progress bar on each loop
My code is...
Do While Range("B" & lngCurrentRow).Text <> ""
'My code goes here
Loop
So the loop continues until Cell Bx is empty
How can i make the progress bar still work as it is an undetermined amount of loops
Many thanks
I found a piece of code online that help me to setup a progress bar on an excel macro that takes a while to run.
I have a small problem with it though - the code uses the For and Next statements and repeats this a set number of times to fill the progress bar.
My code uses the Do While statement as I cannot be sure how many times the code needs to be looped - depends on the users spreadsheet.
The code in question is...
intMax = 100
For intIndex = 1 To intMax
sngPercent = intIndex / intMax
ProgressStyle1 sngPercent, chkPg1Value.Value
DoEvents
'My code goes here
Next
This will count from 1 to 100 and fills the progress bar on each loop
My code is...
Do While Range("B" & lngCurrentRow).Text <> ""
'My code goes here
Loop
So the loop continues until Cell Bx is empty
How can i make the progress bar still work as it is an undetermined amount of loops
Many thanks