I would like to iterate through a row, while summarizing the value of the columns above in a formula. At this point I have data from column 'A' to column 'AV'
The code below does what I want it do, but I'd like to get it into a for-loop that runs preferably to the last column with data. So that I don't have to write 40+ lines of repetitive code.
Dim LastRow As Long
LastRow = ThisWorkbook.Worksheets("Planteleveranse trær 2019").Range("F3").End(xlDown).Row
ThisWorkbook.Worksheets("Planteleveranse trær 2019").Cells(LastRow + 1, "F").Formula = "=SUM(F3:F" & LastRow & ")"
ThisWorkbook.Worksheets("Planteleveranse trær 2019").Cells(LastRow + 1, "L").Formula = "=SUM(L3:L" & LastRow & ")"
ThisWorkbook.Worksheets("Planteleveranse trær 2019").Cells(LastRow + 1, "M").Formula = "=SUM(M3:M" & LastRow & ")"