absolute reference r1c1 code

S

SLP

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)"
 
J

Jacob Skaria

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
 
J

joel

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)
 
Top