This code seems to produce the same answer as the code you posted...

Code:
Sub Test_B()
  Dim LastRow As Long
  LastRow = Range("C" & Rows.Count).End(xlUp).Row
  With Range("O" & Range("L2").Value + 1 & ":O" & LastRow)
    .Formula = "=SUM(OFFSET(C$1:C$" & Range("L2").Value & ",ROW(A1),0))/L$2"
    .Value = .Value
  End With
End Sub