CsJHUN
Active Member
- Joined
- Jan 13, 2015
- Messages
- 360
- Office Version
- 365
- 2021
- 2019
- Platform
- Windows
- Mobile
Hi guys, i googled and forumed many solution for progressbars. Some are way above my head (with kernel inputs, hardware keys, so on), so i try to made one for myself which easily readable and understandable.
I made a simple userform with 3 label. First is just for sub title, third is for text output the current progress and the second for the actual bar, this is 200 pixel wide (this is why i multiple the width by 2)
Hope you like it, enjoy coding :D
I made a simple userform with 3 label. First is just for sub title, third is for text output the current progress and the second for the actual bar, this is 200 pixel wide (this is why i multiple the width by 2)
VBA Code:
Private Sub UserForm_Activate()
inital_value = Range("F4").Value 'as not always 1, it should be 0<
end_value = Range("F5").Value 'as not always 1, it should be (0< & inital_value<
repetion_count = end_value - inital_value
percent_per_repetition_count = 100 / repetion_count
lbl_progress_bar.Width = 0
For i = 1 To repetion_count
lbl_progress_bar.Width = i * percent_per_repetition_count * 2
Application.ScreenUpdating = True
lbl_progress_bar_text.Caption = i & " / " & repetion_count & " (" & Format(i * percent_per_repetition_count/ 100, "0.0%") & ")"
Application.Wait (Now + 2 / 24 / 60 / 60) 'just to see anything happens
Me.Repaint
Application.ScreenUpdating = False
Next i
End Sub
Hope you like it, enjoy coding :D