Earlier this week, I asked for help on progress bars and got some great suggestions, one being to review previous postings on
this subject which I did and got the following code which I can get to work fine..........but I dont know how to insert this
code into one of my macros.
Can anyone give me a few tips on what I need to do, my macro moves between a number of
different sheets, does some sorting, deleting, and copying, how and where do I put this code in the macro.
help would be greatly appreciated,
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
' Initialize variables.
Counter = 1
RowMax = 100
ColMax = 25
' Loop through cells.
For r = 1 To RowMax
For c = 1 To ColMax
'Put a random number in a cell
Cells(r, c) = Int(Rnd * 1000)
Counter = Counter + 1
' Update the percentage completed.
PctDone = Counter / (RowMax * ColMax)
' Call subroutine that updates the progress bar.
' The task is finished, so unload the UserForm.
Sub UpdateProgressBar(PctDone As Single)
' Update the Caption property of the Frame control.
.FrameProgress.Caption = Format(PctDone, "0%")
' Widen the Label control.
.LabelProgress.Width = PctDone * _
(.FrameProgress.Width - 10)
' The DoEvents allows the UserForm to update.