Progress Bar in VBA-Excel Macros
How to Create a Progress Bar in Excel?
Here, you will find a step-by-step tutorial on how to install and use a progress bar for your VBA Excel projects.
When you finish, you will be able to use this progress bar in any file, macro, or code you want just by calling the functions inside the modules.
1) First, you have to download the Userform (both files: ProgressBar.frm and ProgressBar.frx) from my GitHub folder, in this link.
From the same folder, you have to download the ProgressBarModule.bas file.
2) Once you have the three files, you have to import them all into your Excel Macro-Enabled file.
3) In your Excel file, you can use the functions from the ProgressBarModule: StartBar, IncreaseBar, CloseBar, Subtitle.
4) You can download the Excel file example from this GitHub repository.
Here is the code of the Function Example():
Function Example()
Dim dMax As Double, f As Double
dMax = 12345
ProgressBarModule.StartBar dMax, "Here we write a title..."
For f = 1 To dMax
ProgressBarModule.IncreaseBar
If f < 1000 Then
ProgressBarModule.Subtitle "Subtitle: less than 1000.."
ElseIf f < 3000 Then
ProgressBarModule.Subtitle "Subtitle: less than 3000.."
ElseIf f < 5000 Then
ProgressBarModule.Subtitle "Subtitle: less than 5000.."
Else
ProgressBarModule.Subtitle "Subtitle: more than 5000.."
End If
Next
ProgressBarModule.CloseBar
End Function