I want to sum rows from column I to T and display the result in column V.
Currently, my code is:
Sub Sum_column_V()
Dim lastRow As Long, i As Integer, totalItoT As Double, sht As Worksheet
Set sht = ThisWorkbook.Worksheets("Summary")
lastRow = sht.Cells(sht.Rows.Count, "A").End(xlUp).Row
For i = 1 To lastRow
totalItoT = WorksheetFunction.Sum(Range("I" & i & "T" & i))
Next
sht.Range("V" & i) = totalItoT
End Sub
I get the error message: "Run-time error '1004': Method 'Range' of object' Global failed"
What am I doing wrong?