December 4, 2017

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()
UserForm1.Show
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
DoEvents
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

2 thoughts on “How to create progress bar in Excel with vba

  1. The code is excellent for my applications and I thank you very much. He is small and wise. Who needs more than that?

  2. Thank you very much for this work you do.
    This video is very important for my program.
    My project is about maintenance of biomedical strument managment. And for this, I build with Excel macro including more userform. Finally, my program runs well only by interface. To run it I use vscript file as you explain in one of your video.
    My question is that: when I start my vbscript, my program make more time to load a first windows that contains list of items that need maintenance service. I need a progress bar that appear in interval beteween start of script and appear of windows.
    Excuse me for my english
    Thank

Comments are closed.