Hey guys, I'm trying to pull some averages from worksheets that are all formatted the same way. When I run the following I get the
"September
August
Past 12 Months" table at the bottom of the first worksheet (where I put the control button), but nothing on the other pages... Any idea why?
Private Sub CommandButton1_Click()
Dim ws As Worksheet
Dim i As Integer
Dim j As Integer
For Each ws In ActiveWorkbook.Worksheets
ws.Activate
Cells(383, 1).Value = "September"
Cells(384, 1).Value = "August"
Cells(385, 1).Value = "Past 12 Months"
j = 2
For i = 1 To 50
If Cells(7, i).Value = "Score" Or Cells(7, i).Value = "Attention" Then
Cells(382, j).Value = Cells(6, i).Value
Cells(383, j).Value = Application.Average(Range(Cells(373, i), Cells(344, i)))
Cells(384, j).Value = Application.Average(Range(Cells(343, i), Cells(313, i)))
Cells(385, j).Value = Application.Average(Range(Cells(373, i), Cells(9, i)))
j = j + 1
End If
Next i
Next ws
End Sub
Thanks a lot,
C
Bookmarks