Hi everyone,

I figured out how to insert lines after every 3 lines. The following code worked very well for me (assuming the first two lines are headers).

Sub InsertRowsEveryTenthRow()
Dim X As Long, FirstBlankRow As Long, Increment As Long, U As Range
FirstBlankRow = 5
Increment = 3
For X = FirstBlankRow To ActiveSheet.UsedRange.Rows.Count Step Increment
If U Is Nothing Then
Set U = Rows(X)
Else
Set U = Union(U, Rows(X))
End If
Next
U.Insert
End Sub

My question is how I can edit the code, so I can fill the inserted blank lines with averages of the three lines above each blank line?

Thanks a lot!