On 2002-02-19 05:53, MJA wrote:
Hello,
I want to total different columns.
But I can't figure out the right code.
For b = 1 To 15
Cells(b, 16).FormulaR1C1 = "=SUM(C & b)"
Next
This doesn't work.
Who can help me!?
Martin
On 2002-02-19 05:59, Juan Pablo G. wrote:
Try with
Cells(b, 16).FormulaR1C1 = "=SUM(C" & b
But, why use SUM ? that's only one cell, you could just use:
Cells(b, 16).FormulaR1C1 = "=C" & b
On 2002-02-19 06:00, paludgnp wrote:
Hello Martin,
Answering you would be easy if you could explain better what you exactly want.
Do you want to sum the columns from 1 to 15 in the 16th column in row i?
If yes, check the two codes below:
For b=1 to 15
cells(i,16)=cells(i,16)+cells(i,b)
next b
OR
Cells(i, 16).FormulaR1C1 = "=SUM(C1:C15)"
I hope I could help you,
Pierre
This message was edited by paludgnp on 2002-02-19 06:17
On 2002-02-20 05:46, Juan Pablo G. wrote:
Why ? well, because you're only summing column C, not A:C, change it to this:
Code:Sub Test() For x = 1 To 3 Cells(x, 4).Formula = "=SUM(A" & x & ":C" & x & ") Next End Sub
Also, you were mixing two range types, R1C1 with A1 style. This should do the trick.