VBA r1c1 absolute previous row in formula

  • Thread starter Thread starter SLP
  • Start date Start date
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.
 
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.
 
Back
Top