ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Help with stetting Progress Bar (https://www.excelbanter.com/excel-programming/437819-help-stetting-progress-bar.html)

Brian

Help with stetting Progress Bar
 
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



All times are GMT +1. The time now is 02:16 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com