A
Alex St-Pierre
Hi !
I have a userform2 that show a process bar. The program update the % only
when it begins to create a new table. Is there a way to have a progressive %
increase?
Example:
Table #1 takes 10 seconds to create (show 0% at beginning and 20% when
completed)
Table #2 takes 15 seconds to create (show 20% at beginning and 50% when
completed)
Table #3 takes 25 seconds to create (show 50% at beginning and 100% when
completed)
If the table#1 takes 12 seconds to create, it will increase 2% per second
until it reach 20%(no increment between 10 and 12 seconds). Thereafter, for
table #2, it will increase from 20% to 50% according the same increment (2%
per second). I'm wondering what is the best way to do that.
Is it to call a macro a lot of time in the program that calculate the time
and see if it should increase or not the %?
Thank's a lot!
Alex
For now, this is what I use:
Sub MainMacro
vPerc(1) = 0
vPerc(2) = 0.20
vPerc(3) = 0.50 'Cumulative
For i = 1 to 3
Call ProcessBar(vPerc(i),"Creating Table #" & i)
Call CreateMyTable(i)
Next i
End Sub
Sub ProcessBar(ProcessPerc As Variant, ProcessLabel As String)
With Userform2
.TextBox1.Text = ProcessLabel
.Caption = Format(ProcessPerc, "0%")
End With
End Sub
I have a userform2 that show a process bar. The program update the % only
when it begins to create a new table. Is there a way to have a progressive %
increase?
Example:
Table #1 takes 10 seconds to create (show 0% at beginning and 20% when
completed)
Table #2 takes 15 seconds to create (show 20% at beginning and 50% when
completed)
Table #3 takes 25 seconds to create (show 50% at beginning and 100% when
completed)
If the table#1 takes 12 seconds to create, it will increase 2% per second
until it reach 20%(no increment between 10 and 12 seconds). Thereafter, for
table #2, it will increase from 20% to 50% according the same increment (2%
per second). I'm wondering what is the best way to do that.
Is it to call a macro a lot of time in the program that calculate the time
and see if it should increase or not the %?
Thank's a lot!
Alex
For now, this is what I use:
Sub MainMacro
vPerc(1) = 0
vPerc(2) = 0.20
vPerc(3) = 0.50 'Cumulative
For i = 1 to 3
Call ProcessBar(vPerc(i),"Creating Table #" & i)
Call CreateMyTable(i)
Next i
End Sub
Sub ProcessBar(ProcessPerc As Variant, ProcessLabel As String)
With Userform2
.TextBox1.Text = ProcessLabel
.Caption = Format(ProcessPerc, "0%")
End With
End Sub