using VBA to enter a R1C1 formula which contains double quotes "

antaeusguy

Board Regular
Joined
Mar 8, 2010
Messages
81
I want to enter a R1C1 style formula in range("A1") with:

=CONCATENATE(B1, " ",C1," ",D1)

I need to include a space between each cells with " ".

So I wrote this procedure:

Sub enterformula()
Range("a1").FormulaR1C1 = "=CONCATENATE(RC[1]," ",RC[2]," ",RC[3])"
End Sub

It says:
Compile error:
Expected: end of statement

and it highlighted this in blue ",RC[2]," --> showing me where the potential error is...

Does anyone here could help me with this problem? Thanks in advance :)
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
You have to double up the quotes.

Try

Range("a1").FormulaR1C1 = "=CONCATENATE(RC[1],"" "",RC[2],"" "",RC[3])"
 
Upvote 0
Hello,
Welcome to the Message Board!

try:
<font face=Courier New><SPAN style="color:#00007F">Sub</SPAN> enterformula()<br>Range("a1").FormulaR1C1 = "=CONCATENATE(RC[1],"" "",RC[2],"" "",RC[3])"<br><SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Sub</SPAN></FONT>
 
Upvote 0

Forum statistics

Threads
1,224,603
Messages
6,179,855
Members
452,948
Latest member
UsmanAli786

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