Help with stetting Progress Bar

B

Brian

I need some help changing this code to fit my application. When I click on a
control Button I would like for a progress bar to pop up and show the
progress of the Update.

This Control Button Updates my Workbook and all the Header & Footnotes
thru-out the Work Book with input from UserForm1.

The Control Button is Located in in UserForm1.
Control Button = Update_Engineer_Spec_10
Progress Bar is UserForm2

Sub Main()
' Progress Bar for Status of Engineering Spec Update
Dim Counter As Integer
Dim RowMax As Integer, ColMax As Integer
Dim r As Integer, c As Integer
Dim PctDone As Single

If TypeName(ActiveSheet) <> "Worksheet" Then Exit Sub
Cells.Clear
Application.ScreenUpdating = False
Counter = 1
RowMax = 100
ColMax = 25
For r = 1 To RowMax
For c = 1 To ColMax
Cells(r, c) = Int(Rnd * 1000)
Counter = Counter + 1
Next c
PctDone = Counter / (RowMax * ColMax)
With UserForm1
.FrameProgress.Caption = Format(PctDone, "0%")
.LabelProgress.Width = PctDone * (.FrameProgress.Width - 10)
End With
' The DoEvents statement is responsible for the form updating
DoEvents
Next r
Unload UserForm2
End Sub
 

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