I am trying to run the following procedure that entails placing an array formula in a range ("CA2010") on a sheet ("Slate Data").
I've tested the the array formula many times and it produces the desired results.
The sub below gets
run-time '1004' error: Unable to set the FormulaArray property of the Range class.
Sub countuniqueBINs()
Dim placementoutlook As Workbook
Set placementoutlook = Excel.Workbooks("Placement Outlook")
Dim sdws As Worksheet
Set sdws = placementoutlook.Sheets("Slate Data")
sdws.Range("CA2010").NumberFormat = "general"
sdws.Range("CA2010").FormulaArray = "=SUM(IF(FREQUENCY(IF(SUBTOTAL(3,OFFSET(E2:E2000,ROW(E2:E2000)-ROW(E2),0,1)),MATCH(""~""&E2:E2000,E2:E2000&"""",0)),ROW(E2:E2000)-ROW(E2)+1),1))"
End Sub
I tried breaking the array formula into two parts based on some guidance out there, but it still did not resolve the issue.