Run-time error 1004: Unable to set the FormulaArray property of the Range class

jakeman

Active Member
Joined
Apr 29, 2008
Messages
325
Office Version
  1. 365
Platform
  1. Windows
Hey, guys - I have a line of VBA that's giving me trouble and I'm not sure how to solve for it.

I have several lines of code that create formulas for me inside of my table and they all work fine. When I tried to do the same using an array formula, I get an error: "Run-time error 1004: Unable to set the FormulaArray property of the Range class."

The formula that is erroring out is:
Code:
Range("Player_Matchup_tbl[TSFPP]").FormulaArray = "=IF(MAX(IF([POS]=[@POS],[SFP]))=[@SFP],""Top Player"","""")"

Here is an an example of a formula that works just fine:
Code:
Range("Player_Matchup_tbl[AFP]").FormulaR1C1 = "=INDEX(Roster_tbl[FPPG],MATCH([@Player],Roster_tbl[BBall Ref Alias],0))"

My guess is it's got something to do with how the syntax for the Array is to be setup?
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
The syntax of the array formula doesn't look right. Try generating the correct array formula directly in the worksheet holding the table, then translate it to your VBA by doubling the quote marks.
 
Upvote 0
hey JoeMo - I ran the VBA recorder and got this code to work:
Code:
Selection.FormulaArray = "=IF(MAX(IF([POS]=[@POS],[SFP]))=[@SFP],""Top Player"","""")"

I don't see where the difference is because everything looks the same after the
Code:
.FormulaArray = "=IF(MAX(IF([POS]=[@POS],[SFP]))=[@SFP],""Top Player"","""")"

Now, if I could only get the code to work where I tell it where in the table to put the formula.
 
Upvote 0

Forum statistics

Threads
1,215,145
Messages
6,123,291
Members
449,094
Latest member
GoToLeep

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