Sub main()
Dim i As Long
Dim vRet() As Variant
Dim rngBereich As Excel.Range
With Tabelle3: Set rngBereich = .Range(.Cells(5, 3), .Cells(.Cells(.Rows.Count, 1).End(xlUp).Row, 3)): End With
ReDim vRet(1 To rngBereich.Rows.Count)
For i = 5 To UBound(vRet) Step 1
vRet(i) = WorksheetFunction.Average(Range(rngBereich.Cells(i, 1).Offset(0, -1), rngBereich.Cells(i - 4, 1).Offset(0, -1)))
Next i
rngBereich.Cells(1, 1).Resize(UBound(vRet)).Value = Application.Transpose(vRet)
End Sub
|