ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Nelp required to integrate ProgressBar (https://www.excelbanter.com/excel-discussion-misc-queries/151026-nelp-required-integrate-progressbar.html)

Ola2B

Nelp required to integrate ProgressBar
 
I seem to be struggling with how to integrate the progress bar vb
codes with the main program events. Currently, the main program is
executed through a userform that requests for a password to start (the
userform is programmed to call the main event).

Then the problem i'm having is where to position or attach the
progress bar codes to: below is an example i'm trying to follow: And
obviously it needs to call a program? Please note, I have set up the
bar indicator in userform1.


Sub Main()
' Inserts random numbers on the active worksheet
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 UserForm1
End Sub


Thanks.



All times are GMT +1. The time now is 10:18 AM.

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