Status Bar Update with VBA

For particularly long Excel VBA procedures you may wish to show a status bar update as the procedure is running.  This tells the user where Excel is up to in the procedure much like a progress bar but without the grind on the memory which a progress bar will bring.  The status bar is the thin line at the bottom right of the traditional Excel screen where text often appears.  An example is where you may see the word "Calculating" on a particularly calculation intensive or large Excel file.  The following is an example of a status bar update.

The following is the VBA coding to update the status bar.

Option Explicit

Sub StatusBarUpdate() 'Excel VBA to display update % in the status bar.
Dim i As Integer

For i=1 To 10
Application.StatusBar="Task " & i & " is " & (i / 10) * 100 & "% Complete"
Next
Application.StatusBar=False
End Sub

The above VBA coding is a simple 10 iteration loop which will show what stage the code is up to using a percentage indicator.  If you copy the code into a regular module and press F8 10 times you will see the status update in the bottom right of the screen.  A similar procedure in Excel is the Update Caption with VBA procedure.