Sub getAverage()
sht1 = "Sheet1"
sht2 = "Sheet2"
firstRow = 2
Call loopEachColumn(sht1, sht2, firstRow)
End Sub
Sub loopEachColumn(sht1, sht2, firstRow)
lastColumn = Sheets(sht1).Cells(firstRow, Columns.Count).End(xlToLeft).Column
c = 1
Do Until c > lastColumn
Call loopEachRow(sht1, sht2, firstRow, c)
c = c + 1
Loop
End Sub
Sub loopEachRow(sht1, sht2, firstRow, nextColumn)
r = firstRow
c = getColumnLetter(nextColumn)
lastRow = Sheets(sht1).Range(c & Rows.Count).End(xlUp).Row
Do Until r > lastRow
Call averageEveryTenRows(sht1, sht2, c, r)
r = r + 10
Loop
End Sub
Function getColumnLetter(columnNumber)
n = columnNumber
Do
c = ((n - 1) Mod 26)
s = Chr(c + 65) & s
n = (n - c) \ 26
Loop While n > 0
getColumnLetter = s
End Function
Sub averageEveryTenRows(sht1, sht2, c, r)
myCounter = 1
mySum = 0
Do Until myCounter > 10
mySum = mySum + Sheets(sht1).Range(c & r).Value
r = r + 1
myCounter = myCounter + 1
Loop
myAverage = mySum / 10
Call printAverageToNextLine(sht2, c, myAverage)
End Sub
Sub printAverageToNextLine(sht2, c, myAverage)
nextLine = Sheets(sht2).Range(c & Rows.Count).End(xlUp).Row + 1
Sheets(sht2).Range(c & nextLine).Value = myAverage
End Sub