Hi, after I add in the 2 lines once it finds differences in Column D, I want to average the cell values in Column G and H.

So it adds 2 blank lines once it finds a difference, then on the first added blank line, I want the average to be calculated automatically for Columns G and H. Where can i add it to the code below?

Code below:

Sub InsertLine()
Dim lRow As Long
For lRow = Cells(Cells.Rows.Count, "D").End(xlUp).Row To 2 Step -1
If Cells(lRow, "D") <> Cells(lRow - 1, "D") Then Rows(lRow).EntireRow.Insert
Next lRow
End Sub

Thanks!