Code:
Private Sub CommandButton5_Click()
Dim i, j, total, num1, num2, num3, num4 As Integer
Dim pct As Single
'For j = 1 To 2
total = 100
num1 = num2 = num3 = num4 = 25
pct = 0.01 * 100 / total
For i = 1 To num1
lblProg2.Width = lblProg2.Width + pct * lblProg1.Width
'lblProg3.Caption = j & "%"
lblProg3.Caption = Format(lblProg2.Width / lblProg1.Width * 100, "#") & " %"
DoEvents
Next
For i = 1 To num2
lblProg2.Width = lblProg2.Width + pct * lblProg1.Width
lblProg3.Caption = Format(lblProg2.Width / lblProg1.Width * 100, "#") & " %"
'lblProg3.Caption = Format((i + 1) / fleCount * 100, "#") & " %"
DoEvents
Next
For i = 1 To num3
lblProg2.Width = lblProg2.Width + pct * lblProg1.Width
lblProg3.Caption = Format(lblProg2.Width / lblProg1.Width * 100, "#") & " %"
'lblProg3.Caption = Format((i + 1) / fleCount * 100, "#") & " %"
DoEvents
Next
For i = 1 To num4
lblProg2.Width = lblProg2.Width + pct * lblProg1.Width
lblProg3.Caption = Format(lblProg2.Width / lblProg1.Width * 100, "#") & " %"
'lblProg3.Caption = Format((i + 1) / fleCount * 100, "#") & " %"
DoEvents
Next
'Next
End Sub
But I have a trouble : some time when finished the result is 99%
So anyone can show me which point is not correct?
Thanks.