Why am I getting run time error 1004 for one part of this code only?

Bert_Withpeterson

New Member
Joined
Aug 14, 2018
Messages
7
Hi all,

The below code works with regards to populating cells B3 and B8, but when it gets to populating C8 it throws up 'run time error 1004' - I can't see what the difference is with this compared to the other two sections of code, that don't trigger an error. Can anyone help please?


'Index match the most recent date
Range("B3").Select
Selection.FormulaArray = _
"=INDEX('PublicHealthOutcomesFramework-D'!C[12],MATCH(1,(R[-2]C='PublicHealthOutcomesFramework-D'!C)*(R[-1]C='PublicHealthOutcomesFramework-D'!C[1])*(R[21]C[-1]='PublicHealthOutcomesFramework-D'!C[11]),0))"


'Add in the index match formulae


Range("B8").Select
Selection.FormulaArray = _
"=INDEX('PublicHealthOutcomesFramework-D'!C[13],MATCH(1,(R[-7]C='PublicHealthOutcomesFramework-D'!C)*(R[-6]C='PublicHealthOutcomesFramework-D'!C[1])*(R[-5]C='PublicHealthOutcomesFramework-D'!C[12])*(RC[-1]='PublicHealthOutcomesFramework-D'!C[5]),0))"


Range("C8").Select
Selection.FormulaArray = _
"=INDEX('PublicHealthOutcomesFramework-D'!C[13],MATCH(1,(R[-7]C[-1]='PublicHealthOutcomesFramework-D'!C[-1])*(R[-6]C[-1]='PublicHealthOutcomesFramework-D'!C)*(R[-5]C[-1]='PublicHealthOutcomesFramework-D'!C[11])*(RC[-2]='PublicHealthOutcomesFramework-D'!C[4]),0))"
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
The third formula is over 255 characters, which is why it fails - it's a limitation of the formulaarray property. Can you shorten the sheet name?
 
Upvote 0

Forum statistics

Threads
1,215,155
Messages
6,123,331
Members
449,098
Latest member
thnirmitha

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