How to create progress bar in Excel with vba

How to create a progress bar or indicator in Excel with VBA. Often when we load large Excel workbooks or perform large calculations on hundreds of thousands of worksheet cells, Excel might appear to hang. To let the user know that the things are working fine we can create a progress bar. Such a progress bar or indicator can be easily created using a looping process or a timer. Watch the video below to learn how to create an elegant progress bar using two labels on a user-form.

Watch this video on YouTube.

Here’s the complete VBA code to build a progress indicator:

Private Sub Workbook_Open()
End Sub

Private Sub UserForm_Activate()
Dim remainder As Long
Dim i As Long, j As Long
remainder = 0
For i = 1 To 200

UserForm1.Label2.Width = UserForm1.Label2.Width + 1
If i Mod 2 = 0 Then
remainder = remainder + 1
UserForm1.Caption = remainder & ” % complete”
UserForm1.Label2.Caption = remainder & “%”
End If
For j = 1 To 600
Next j
Next i
MsgBox “Loading of program complete.”
Unload UserForm1
End Sub

Download the sample file:

Further reading:

How to create a progress bar