VBA r1c1 absolute previous row in formula

S

SLP

Hi, I get an error message when I run this code:

ActiveCell.FormulaR1C1 = "=round(R-1C*RC[7],2)"

I need to use the cell directly above the cell the where the pointer is. If
I don't make it an absolute reference it works fine but I need it to be an
absolute as the formula gets copied down. Also, this gets used threw out the
routine so I can't hard set the cell above.

Thanks.
 
N

Niek Otten

of course that should have been

ActiveCell.FormulaR1C1 = "=round(R" & activecell.row - 1 & "C*RC[7],2)"

--
Kind regards,

Niek Otten
Microsoft MVP - Excel

Niek Otten said:
ActiveCell.FormulaR1C1 = "=round(R" & activecell.row & "C*RC[7],2)"

--
Kind regards,

Niek Otten
Microsoft MVP - Excel


SLP said:
Hi, I get an error message when I run this code:

ActiveCell.FormulaR1C1 = "=round(R-1C*RC[7],2)"

I need to use the cell directly above the cell the where the pointer is.
If
I don't make it an absolute reference it works fine but I need it to be
an
absolute as the formula gets copied down. Also, this gets used threw out
the
routine so I can't hard set the cell above.

Thanks.
 

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