Error in named cell formula

Gregfox

Board Regular
Joined
Apr 12, 2011
Messages
120
Error in named cell formula
Hi, I am trying to multiply a named cell with an unnamed cell and can’t find a solution. I have the following named cells A1-one, B1=two. If I use code .Range("C1").FormulaR1C1 = "=(one*two)", I get the correct answer, however if I use the code .Range("C1").FormulaR1C1 = "=(one*B2)" I get #NAME?
Soooo, my question is
A. can I multiply a named cell with an un-named cell?
B. What does .FormulaR1C1 mean?
Rich (BB code):
Sub testname()
With ThisWorkbook.Worksheets("sheet1")
<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p>
.Range("one").Formula = (5#)
.Range("two").Formula = (10#)
.Range("C1").FormulaR1C1 = "=(one*b2)"
<o:p></o:p>
End With
End Sub
<o:p>Thanks.</o:p>
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
Because B2 is in A1 notation. Try
Code:
.Range("C1").FormulaR1C1 = "=one*R[1]C[-1]" :Rem relative reference
Rem or
.Range("C1").FormulaR1C1 = "=one*R2C2" :Rem absolute reference
 
Upvote 0
It isn't an R1C1 formula which is why it fails. Try

Code:
Range("C1").Formula = "=(one*b2)"
 
Upvote 0
You can, or at least should be able to, B2 isn't an R1C1 reference, thats where the problem is coming from.

B2 in R1C1 reference terms is R2C2 (Row 2 Column 2)

Rich (BB code):
.Range("C1").Formula = "=(one*b2)"
.Range("C1").FormulaR1C1 = "=(one*R2C2)"

Hopefully that expalins what formulaR1C1 means as well.
 
Upvote 0

Forum statistics

Threads
1,224,552
Messages
6,179,487
Members
452,917
Latest member
MrsMSalt

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top