formula

H

harm.charles

I'm trying to to use this formula, but receive error.

Range("D" & Rlrow + 1 & ":O" & Rlrow + 1).FormulaR1C1 = "=SUM(""R[-" &
Rlrow & "]C:R[-1]C)" & ")"

this is the actual code recorded

"=SUM(R[-40]C:R[-1]C)"

Any help would be appreciated.
 
D

Dave Peterson

Range("D" & rlRow + 1 & ":O" & rlRow + 1).FormulaR1C1 _
= "=SUM(R[-" & rlRow & "]C:R[-1]C)"

But isn't that pretty much the same as:

Range("D" & rlRow + 1 & ":O" & rlRow + 1).FormulaR1C1 _
= "=SUM(R1C:R[-1]C)"

I'm trying to to use this formula, but receive error.

Range("D" & Rlrow + 1 & ":O" & Rlrow + 1).FormulaR1C1 = "=SUM(""R[-" &
Rlrow & "]C:R[-1]C)" & ")"

this is the actual code recorded

"=SUM(R[-40]C:R[-1]C)"

Any help would be appreciated.
 
F

FSt1

hi
try this...
Range("D" & Rlrow + 1 & ":O" & Rlrow + 1).FormulaR1C1 = _
"=SUM(R[-" & Rlrow & "]C:R[-1]C)"

regards
FSt1
 
H

harm.charles

hi
try this...
Range("D" & Rlrow + 1 & ":O" & Rlrow + 1).FormulaR1C1 = _
"=SUM(R[-" & Rlrow & "]C:R[-1]C)"

regards
FSt1

I'm trying to to use this formula, but receive error.
Range("D" & Rlrow + 1 & ":O" & Rlrow + 1).FormulaR1C1 = "=SUM(""R[-" &
Rlrow & "]C:R[-1]C)" & ")"
this is the actual code recorded
"=SUM(R[-40]C:R[-1]C)"

Any help would be appreciated.

Thanks Dave and FSt1.
The formula you provided works.
 
H

harm.charles

It would be beneficial if you could explain waht the formula is meant to
do!, you would be better off using something like =SUM(Rlrow.address &
":" & ....etc

[email protected];176867 said:
I'm trying to to use this formula, but receive error.
Range("D" & Rlrow + 1 & ":O" & Rlrow + 1).FormulaR1C1 = "=SUM(""R[-" &
Rlrow & "]C:R[-1]C)" & ")"
this is the actual code recorded
"=SUM(R[-40]C:R[-1]C)"

Any help would be appreciated.

--
Simon Lloyd

Regards,
Simon Lloyd
'The Code Cage' (http://www.thecodecage.com)

Simon thank for the input. I thought about giving more detail, but it
was after my post. The next time I post I'll be more specific.
Dave this code:
Range("D" & rlRow + 1 & ":O" & rlRow + 1).FormulaR1C1 _
= "=SUM(R1C:R[-1]C)"
Is like you say basically the same as the original code.
My problem is using formulas in code is a weakness which I hope to
over come.
Once again thanks to all who responded to my problem.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top