PDA

View Full Version : Solved: Statusbar progress percentage value



Remalay
03-21-2007, 03:35 AM
Hi Guys,:hi:

I'm using the Statusbar as a progress indicator as defined within;
http://vbaexpress.com/kb/getarticle.php?kb_id=87

This works great, but is presenting too precise a percentage figure as a simple indicator (the example uses a neat total, whereas my reality total is something akin to '573' or '339'). Can the format of the displayed percentage be limited to an integer value somehow? (I tried using 'Round' with no success)

thnx

Bob Phillips
03-21-2007, 03:39 AM
Change the format



Application.StatusBar = "Progress: " & x & " of 250: " & Format(x / 250, "0%")

Remalay
03-21-2007, 03:44 AM
Simple (and ever-so obvious :blush )when you know how. Thanks XLD.

Charlize
03-21-2007, 03:47 AM
Sub StatusBar()
Dim x As Long
Dim vloop As Long
Dim MyTimer As Double
x = Application.InputBox("Give number", "Give number ...", , , , , , 1)
For vloop = 1 To x
MyTimer = Timer
Do
Loop While Timer - MyTimer < 0.03
Application.StatusBar = "Progress: " & vloop & _
" of " & x & ": " & Format(vloop / x, "Percent")
DoEvents
Next vloop
Application.StatusBar = False
End Sub