ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   absolute reference r1c1 code (https://www.excelbanter.com/excel-programming/435895-absolute-reference-r1c1-code.html)

SLP

absolute reference r1c1 code
 
How do I turn this so the first cell is an absolute reference? When I delete
the [] around the -1, I get an error message. Thanks.

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

Jacob Skaria

absolute reference r1c1 code
 
Try the below

'Column and row locked
ActiveCell.FormulaR1C1 = "=round(R" & ActiveCell.Row - 1 & "C" & _
ActiveCell.Column & "*RC[7],2)"

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


If this post helps click Yes
---------------
Jacob Skaria


"SLP" wrote:

How do I turn this so the first cell is an absolute reference? When I delete
the [] around the -1, I get an error message. Thanks.

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


joel[_190_]

absolute reference r1c1 code
 

You can always use A1 addressing

Cell1Addr = cells(Activecell.Row - 1,ActiveCell.column).address
Cells2Addr = cells(activecell.Row,Activecell.column + 7).address
ActiveCell.Formula = "=round(" & Cell1Addr & "*" & Cell2Addr & ",2)"


--
joel
------------------------------------------------------------------------
joel's Profile: http://www.thecodecage.com/forumz/member.php?userid=229
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=151771

Microsoft Office Help



All times are GMT +1. The time now is 09:10 AM.

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