vba entering a R1C1 formula

gtd526

Well-known Member
Joined
Jul 30, 2013
Messages
660
Office Version
  1. 2019
Platform
  1. Windows
Hello,
I'm trying to enter a formula using R1C1 formula, but Im receiving an error. The Row will adjust to the cell Im entering the formula.
Its referring to another workbook/worksheet.
Here is the formula Im trying to enter:
Selection.FormulaR1C1 = "=IF(RC12="","",SUMIFS([NBA.xlsm]Favs!R7C44,R142C64,[NBA.xlsm]Favs!$R5C40,R140C60,RC12))"

Thank you.
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
You need to double up your quotes


VBA Code:
=IF(RC12="""","""",SUMIFS([NBA.xlsm]Favs!R7C44,R142C64,[NBA.xlsm]Favs!$R5C40,R140C60,RC12)
 
Upvote 0
You need to double up your quotes


VBA Code:
=IF(RC12="""","""",SUMIFS([NBA.xlsm]Favs!R7C44,R142C64,[NBA.xlsm]Favs!$R5C40,R140C60,RC12)
I made the correction, but still receive an error:
code im using:
VBA Code:
Range("P100000").End(xlUp).Select
        Range(Selection, Selection.End(xlUp)).Select
'        Selection.FormulaR1C1 = "=IF(RC12="","",SUMIFS([NBA.xlsm]Favs!R7C44,R142C64,[NBA.xlsm]Favs!$R5C40,R140C60,RC12))"
        Selection.FormulaR1C1 = "=IF(RC12="""","""",SUMIFS([NBA.xlsm]Favs!R7C44,R142C64,[NBA.xlsm]Favs!$R5C40,R140C60,RC12)"
I also modified the ")" and the end to "))" but received the same error.
 
Upvote 0
Post your formula that you put in the cell manually.
 
Upvote 0
Try
VBA Code:
        Selection.FormulaR1C1 = "=IF(RC12="""","""",SUMIFS([NBA.xlsm]Favs!R7C44:R142C64,[NBA.xlsm]Favs!R5C40:R140C60,RC12))"
 
Upvote 0
Solution
Try
VBA Code:
        Selection.FormulaR1C1 = "=IF(RC12="""","""",SUMIFS([NBA.xlsm]Favs!R7C44:R142C64,[NBA.xlsm]Favs!R5C40:R140C60,RC12))"
It works. Good catch, the "$".
Thank you.
 
Upvote 0
Glad we could help & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,215,731
Messages
6,126,535
Members
449,316
Latest member
sravya

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