VBA beginner here, attempting to sum variable number of columns down each row.
I want to sum from column G to the next blank column (number of columns vary), with the sum of each row in column F (number of rows also varies)
This is as close as I've gotten:
I want to sum from column G to the next blank column (number of columns vary), with the sum of each row in column F (number of rows also varies)
This is as close as I've gotten:
VBA Code:
Sub addcolumns()
Dim i As Long
LastColumn = ThisWorkbook.Sheets("sheet1").Cells(2, Columns.Count).End(xlToRight)
For i = 2 To Cells(Rows.Count, "G").End(xlDown).Row
Range("F" & i) = WorksheetFunction.Sum(Range("G" & i & ":" LastColumn & i))
Next i
End Sub