You are on page 1of 1

COde VBA

Sub averger()
Dim i, j, x, y As Integer
Dim rows, cols, rng
x = 2
y = 60
Dim l As Long

l = Cells.Find(What:="*", _
After:=Range("A1"), _
LookAt:=xlPart, _
LookIn:=xlFormulas, _
SearchOrder:=xlByRows, _
SearchDirection:=xlPrevious, _
MatchCase:=False).Row
MsgBox l
For j = 2 To Round(((l - 2) / 60), 0)
rows = "B" & x
cols = "B" & y
rng = rows & ":" & cols
Range("B" & j).Value = Application.WorksheetFunction.Average(Range(rng))
x = y + 1
y = y + 60
Next j

End Sub

Page 1

You might also like