Finding last cell and insert line
Ok found an error with the first code I posted, it will chop the last
data line off and insert the formulas, sorry for the multiple posts.
Try this...
Sub AddFormulas()
Range("A1").Select
Do Until Cells(ActiveCell.Row + 1, 1) = "" And Cells(ActiveCell.Row +
2, 1) = ""
If ActiveCell = "" Then
Selection.EntireRow.Insert
ActiveCell.Range( _
"C1,F1:J1").FormulaR1C1 = "=Sum(R2C:R[-1]C)"
ActiveCell.Offset(2, 0).Select
Else
Cells(ActiveCell.Row + 1, 1).Select
End If
Loop
Cells(ActiveCell.Row + 1, 1).Select
Selection.EntireRow.Insert
ActiveCell.Range( _
"C1,F1:J1").FormulaR1C1 = "=Sum(R2C:R[-1]C)"
ActiveCell.Offset(2, 0).Select
End Sub
|