Oops, simple syntax error on my part concerning LastRow2 and LastRow3. Replace the previous code i posted with this:

For i = 4 To 19
Col = Split(ws2.Cells(LastRow2 + 6, i).Address, "$")(1)
ws2.Cells(LastRow2 + 6, i).Formula = "=SUM(" & Col & "2:" & Col & LastRow2 + 1 & ")"
Next


For i = 4 To 19
Col = Split(ws3.Cells(LastRow3 + 6, i).Address, "$")(1)
ws3.Cells(LastRow3 + 6, i).Formula = "=SUM(" & Col & "2:" & Col & LastRow3 + 1 & ")"
Next