Summing
SUM is a worksheetfunction, and you are trying to use it VBA. You can either
- use a straight worksheet function of SUM, no V BA
- use a worksheetfunction in VBA - Cells(i, 4) =
WorksheetFunction.SUM(Range("A"& i & ":C" & i))
- add in V BA - Cells(i, 4).Value = Cells(i, 1).Value + Cells(i,2).Value +
Cells(i,3).Value
--
HTH
-------
Bob Phillips
"teresa" wrote in message
...
Hi,
I have three columns of data and 100 rows,
I want the 4th column to sum each row,
the code I have is as follows:
Think there is something wrong with my SUM Function
Dim i, j
For i = 1 To 100
Cells(i, 4) = Sum(Cells(i, 1), Cells(i,3))
End Sub
|