ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   VBA r1c1 absolute previous row in formula (https://www.excelbanter.com/excel-programming/435891-vba-r1c1-absolute-previous-row-formula.html)

SLP

VBA r1c1 absolute previous row in formula
 
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.

Barb Reinhardt

VBA r1c1 absolute previous row in formula
 
ActiveCell.FormulaR1C1 = "=round(R[-1]C*RC[7],2)"

"SLP" wrote:

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.


Niek Otten

VBA r1c1 absolute previous row in formula
 
ActiveCell.FormulaR1C1 = "=round(R" & activecell.row & "C*RC[7],2)"

--
Kind regards,

Niek Otten
Microsoft MVP - Excel


"SLP" wrote in message
...
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.



Niek Otten

VBA r1c1 absolute previous row in formula
 
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" wrote in message
...
ActiveCell.FormulaR1C1 = "=round(R" & activecell.row & "C*RC[7],2)"

--
Kind regards,

Niek Otten
Microsoft MVP - Excel


"SLP" wrote in message
...
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.





All times are GMT +1. The time now is 08:59 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com