Nimrod,
The code that I have posted populates a work schedule that assigns tasks.
One of the reasons it runs slow is that is has a lot of Countif, Sumif, and array formula updating as the code is running. It really only takes about 1-2 mins to run which is OK. I just wanted to use the meter to appease the user. I created my own form, and can run it based on some code at the Knowledge base (see jmiskey's post) but I can't figure out where to run the code in my sub.
The code from the site is :
Sub Main()
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
Next c
' Update the percentage completed.
PctDone = Counter / (RowMax * ColMax)
' Call subroutine that updates the progress bar.
UpdateProgressBar PctDone
Next r
' The task is finished, so unload the UserForm.
Unload frmWait
End Sub
Sub UpdateProgressBar(PctDone As Single)
With frmWait
' Update the Caption property of the Frame control.
.FrameProgress.Caption = Format(PctDone, "0%")
' Widen the Label control.
.LabelProgress.Width = PctDone * _
(.FrameProgress.Width - 10)
End With
' The DoEvents allows the UserForm to update.
DoEvents
End Sub
Here is my Sub
Sub Tasks()
Dim need As Integer
'Application.ScreenUpdating = False
skillx = 9
timeStart = -1
timeStart2 = 1
For period = 1 To 12
timeStart2 = timeStart2 + 6
timeStart = timeStart + 8
For skilly = 104 To 124
skillNam = Sheet236.Cells(skillx, skilly).Value
need = Sheet236.Cells(period + 318, skilly - 97).Value - Sheet236.Cells(period + 304, skilly - 97).Value
If skillNam = "ENG" Then
Eng period, timeStart2, skilly, need ' Eng period, timeStart, skilly, need
ElseIf skillNam = "IND" Then
Ind period, timeStart, skilly, need
Else
OtherSkill period, timeStart, skilly, skillNam, need
End If
Next skilly
Next period
Application.ScreenUpdating = True
End Sub
Thanks for your help