Trying to adapt progress meter

H

hotherps

Hi I'm using the following code behind a form to activate a form with
prgress meter on it. The form looks and acts the way I want it to no
but I have to adapt it to my code.

Instead of using the RowMax and ColMax variables, I would like to refe
to two cells on my worksheet. One is "Requested" C5 and one i
"Received" C6 once Received - Requested is complete (which might not b
100%) the meter should advance to 100% and then close.

Sub ShowUserForm()
UserForm1.Show
End Sub

Sub TestForm()
Dim Counter As Integer
Dim RowMax As Integer, ColMax As Integer
Dim r As Integer, c As Integer
Dim PctDone As Single

Application.ScreenUpdating = False

Counter = 1
RowMax = 400
ColMax = 55

For r = 1 To RowMax
For c = 1 To ColMax

Range("A1").Value = Int(Rnd * 1000)
Counter = Counter + 1
Next c

PctDone = Counter / (RowMax * ColMax)

UpdateProgressBar PctDone
Next r

Unload frmWait
End Sub

Sub UpdateProgressBar(PctDone As Single)
With frmWait

.FrameProgress.Caption = Format(PctDone, "0%")

.LabelProgress.Width = PctDone * _
(.FrameProgress.Width - 10)
End With

DoEvents
End Sub


Thank
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top