I get the run-time error 1004: unable to set the FormulaArray property of the Range class. I have been researching this problem but I can't find a solution to it. It is not longer than 255 character. I am trying to put the formula in a new table column too, so maybe that is part of the problem.
Could the problem be the "Rows(R8C:RC)" Portion I am trying to make this a relative reference so that it will reference to the table the formula is in?
When I "debug.print Trans_ID" I get the correct code but maybe the R8C:RC is not changing to the correct cell reference.
Dim Trans_ID As String
'AccountNumber is equal to 1003
Trans_ID = "=IFERROR(INDEX(Journal,SMALL(IF(L_" & AccountNumber & _
"=Journal[Acct. '#],Journal[Trans ID],""""),ROWS(R8C:RC)),MATCH(Ledger_" & _
AccountNumber & "[[#Headers],[Trans ID]],Journal[#Headers],0)),"""")"
Worksheets("Ledger").ListObjects(NewTableName.Name).ListColumns( _
"Trans ID").DataBodyRange.FormulaArray = Trans_ID
This will return a single number. It works when I enter enter the formula in not using VBA.
Worksheets("Ledger").ListObjects(NewTableName.Name).ListColumns( _ "Trans ID").DataBodyRange.Cells(1).FormulaArray = Trans_ID
? - BigBen