status bar number format

  • Thread starter Thread starter Annika
  • Start date Start date
A

Annika

Does anyone know how to apply a number format to part of a
status bar in VBA? My status bar let users know how much
of the macro is done. The end count variable is user-
defined, but I have put in 1000 simply as an example.
The status bar works fine, but there are about 14 decimal
places in the percentage value. I tried creating a
variable for the "100 * (i/EndCount)" part, but I can't
seem to assign a nuber format to that either.
Help!
********************************************************
Const Startcount= 0
Const Endcount = 1000

For i = StartCount to EndCount Step1

Application.StatusBar = "Part 1 of 2: " & 100 * (i /
EndCount) & "% complete"
 
Annika,

Hers is an example of how to do it, using a percentage format.

Const Startcount = 0
Const Endcount = 1000
Dim i As Long

For i = Startcount To Endcount Step 1

Application.StatusBar = "Part 1 of 2: " & Format((i / Endcount), "#0.00%")
& " complete"

Next i

This gives you 2 dec places, adjust to suit
 
Back
Top