VBA error, Unable to set the FormulaArray property of the Range class

vrsharma

New Member
Joined
Aug 4, 2019
Messages
18
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
Hi All,

Please help me solving this error. I have read several post on this error but still I am unable still unable to find solution.
This error occurs since below array formula have extended more than 255 char.
Please help me how should I break this formula to make my code work. I am using Excel 2016 version. Thanks in advance.


Sub Macro2()


Range("C16").Select


Selection.FormulaArray = _ "=IF(ROWS(Template!R16C:RC)>R8C6,"""",INDEX(THICK!R3C1:R1000C[-2],SMALL(IF(THICK!R3C1:R1000C1>=Template!R7C3,IF(THICK!R3C1:R1000C1<=Template!R8C3,IF(THICK!R3C1:R1000C1>=Template!R9C3,IF(THICK!R3C1:R1000C1<=Template!R10C3,ROW(THICK!R3C1:R1000C1)-ROW(THICK!R3C1)+1)))),ROWS(Template!R16C:RC))))"
Selection.AutoFill Destination:=Range("C16:C21")

Range("C16:C21").Select
Range("B14").Select


End Sub
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
Try...

Code:
Sub Macro2()

    Dim formulaPart As String
    
    formulaPart = "SMALL(IF(THICK!$A$3:$A$1000>=Template!$C$7,IF(THICK!$A$3:$A$1000<=Template!$C$8," & _
                        "IF(THICK!$A$3:$A$1000>=Template!$C$9,IF(THICK!$A$3:$A$1000<=Template!$C$10," & _
                        "ROW(THICK!$A$3:$A$1000)-ROW(THICK!$A$3)+1)))),ROWS(Template!C$16:C16))"


    With Range("C16")
        .FormulaArray = "=IF(ROWS(Template!C$16:C16)>$F$8,"""",INDEX(THICK!$A$3:A$1000,X_X_X))"
        .Replace "X_X_X", formulaPart, xlPart
        .AutoFill Destination:=Range("C16:C21")
    End With


End Sub

Hope this helps!
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,337
Members
452,636
Latest member
laura12345

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