I have the following VBA code and try to sum the range from B2 to CY2 for DA2; then B3 to CY3 for DA3, etc. Therefore I use the for loop. It results in "Application defined or Object defined error".
Could anybody help me to correct the syntax?
-----------------------------------------------------------------------
Sub CalculatePhi()
For i = 2 To 103
Cells(i, 104) = Application.WorksheetFunction.Sum(Range("B &i& ", "CY &i& ")) / 101
Cells(104, i + 1) = Application.WorksheetFunction.Sum(Range(Cells(i + 1, 2), Cells(i + 1, 103))) / 101
Next i
End Sub
Bookmarks