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

FreddieITA91

New Member
Joined
May 30, 2024
Messages
4
Office Version
  1. 2019
Platform
  1. Windows
Hi all

i'm desperate. Ive this formula that needs to be calculated as matrix array on specific row. I think the problem is that it's too long.

VBA Code:
 Dim formula As String
                formula = "=IF(TEXTJOIN("","", TRUE, IF(G" & RowIndex & ":AAF" & RowIndex & " <> """", " & _
             "IFERROR(LEFT(G" & RowIndex & ":AAF" & RowIndex & ", FIND(CHAR(10), G" & RowIndex & ":AAF" & RowIndex & ") - 1) & "":"" & " & _
             "TEXT(G$3:AAF$3, ""dd-mm"") & "" ("" & G$1:AAF$1 & "")"", " & _
             "G" & RowIndex & ":AAF" & RowIndex & " & ""("" & G$1:AAF$1 & "")""), """"), """"), " & _
             "IF(TEXTJOIN("","", TRUE, IF(G" & RowIndex & ":AAF" & RowIndex & " <> """", " & _
             "IFERROR(LEFT(G" & RowIndex & ":AAF" & RowIndex & ", FIND(CHAR(10), G" & RowIndex & ":AAF" & RowIndex & ") - 1) & "":"" & " & _
             "TEXT(G$3:AAF$3, ""dd-mm"") & "" ("" & G$1:AAF$1 & "")"", " & _
             "G" & RowIndex & ":AAF" & RowIndex & " & ""("" & G$1:AAF$1 & "")""), """"), """") <> """", " & _
             "TEXTJOIN("","", TRUE, IF(G" & RowIndex & ":AAF" & RowIndex & " <> """", " & _
             "IFERROR(LEFT(G" & RowIndex & ":AAF" & RowIndex & ", FIND(CHAR(10), G" & RowIndex & ":AAF" & RowIndex & ") - 1) & "":"" & " & _
             "TEXT(G$3:AAF$3, ""dd-mm"") & "" ("" & G$1:AAF$1 & "")"", " & _
             "G" & RowIndex & ":AAF" & RowIndex & " & ""("" & G$1:AAF$1 & "")""), """"), """")), " & _
             "IF(F" & RowIndex & " <> """", ""DA-PIANIFICARE"", """"))"
        
            
            Me.Cells(RowIndex, "D").FormulaArray = formula
            Me.Cells(RowIndex, "D").Calculate
            Me.Cells(RowIndex, "D").Value = Me.Cells(RowIndex, "D").Value
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
i've tried to use a shorter formula but same problem:


Me.Cells(RowIndex, "D").FormulaArray = _ "=IF(TEXTJOIN("","", TRUE, IF(G" & RowIndex & ":WF" & RowIndex & "<>"""", IF(G$3:WF$3<>"""", TEXT(G$3:WF$3,""dd-mm""), G" & RowIndex & ":WF" & RowIndex & " & "" ("" & G$1:WF$1 & "")""), """"))<>"""", TEXTJOIN("","", TRUE, IF(G" & RowIndex & ":WF" & RowIndex & "<>"""", IF(G$3:WF$3<>"""", TEXT(G$3:WF$3,""dd-mm""), G" & RowIndex & ":WF" & RowIndex & " & "" ("" & G$1:WF$1 & "")""), """")), IF(F" & RowIndex & "<>"""", ""DA-PIANIFICARE"", """"))"
 
Upvote 0

Forum statistics

Threads
1,220,965
Messages
6,157,120
Members
451,399
Latest member
alchavar

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