R1C1 formula 1004 error

Mpotten

New Member
Joined
Apr 2, 2015
Messages
12
HI Brains trust

I have an issue in that when trying to insert a formula into my table i get a 1004 error and bumped in to debug mode.

the following code is from the macro I am working on. code in green is working but code in red does not work.



LastRow = Cells(Rows.Count, "B").End(xlUp).Row
Range("M2:M" & LastRow).FormulaR1C1 = "=sum(RC[1]/RC[-1])"


Columns("M:N").NumberFormat = "_-[$$-C09]* #,##0.00_-;-[$$-C09]* #,##0.00_-;_-[$$-C09]* ""-""??_-;_-@_-"


LastRow = Cells(Rows.Count, "B").End(xlUp).Row
Range("H2:H" & LastRow).FormulaR1C1 = "=trim(right(RC[-1],3)"
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
Your formula is missing a right parenthesis.

Code:
Range("H2:H" & LastRow).FormulaR1C1 = "=trim(right(RC[-1],3)[COLOR=#FF0000])[/COLOR]

Also I recommend using CODE tags.
 
Last edited:
Upvote 0
typical I was staring at that for ages and could not work it out.

appreciate your help thanks
 
Last edited:
Upvote 0
My answer was missing a close quote :oops:

Code:
Range("H2:H" & LastRow).FormulaR1C1 = "=trim(right(RC[-1],3)[COLOR=#FF0000])"[/COLOR]
 
Upvote 0

Forum statistics

Threads
1,215,824
Messages
6,127,098
Members
449,358
Latest member
Snowinx

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