Hi, I just did a Record Macro and Excel doesn't like this part of the code:
Range("A30").Select
Selection.FormulaArray = _
"=IF(ISERROR(INDEX(Sheet2!C1:C2,SMALL(IF(Sheet2!C1:C2=R29C1,ROW(Sheet2!C1:C2)),ROW(R[-29])),1)),"""",INDEX(Sheet2!C1:C2,SMALL(IF(Sheet2!C1:C2=R29C1,ROW(Sheet2!C1:C2)),ROW(R[-29])),1))"
Range("B30").Select
Selection.FormulaArray = _
"=IF(OR(INDEX(Sheet2!C1:C2,SMALL(IF(Sheet2!C1:C2=R29C1,ROW(Sheet2!C1:C2)),ROW(R[-29])),2)=R29C2,ISERROR(INDEX(Sheet2!C1:C2,SMALL(IF(Sheet2!C1:C2=R29C1,ROW(Sheet2!C1:C2)),ROW(R[-29])),2))),"""",INDEX(Sheet2!C1:C2,SMALL(IF(Sheet2!C1:C2=R29C1,ROW(Sheet2!C1:C2)),ROW(R[-29])),2))"
Range("A30:B30").Select
Selection.AutoFill Destination:=Range("A30:B34"), Type:=xlFillDefault
Range("A30:B34").Select
Range("B28").Select
What does Unable to set the FormulaArray Property of the Range Class? mean and can you see why.
I tried just going into the code and replacing the formulae with the actual ones:
=IF(ISERROR(INDEX(Sheet2!$A:$B,SMALL(IF(Sheet2!$A:$B=$A$29,ROW(Sheet2!$A:$B)),ROW(1:1)),1)),"",INDEX(Sheet2!$A:$B,SMALL(IF(Sheet2!$A:$B=$A$29,ROW(Sheet2!$A:$B)),ROW(1:1)),1))
=IF(OR(INDEX(Sheet2!$A:$B,SMALL(IF(Sheet2!$A:$B=$A$29,ROW(Sheet2!$A:$B)),ROW(1:1)),2)=$B$29,ISERROR(INDEX(Sheet2!$A:$B,SMALL(IF(Sheet2!$A:$B=$A$29,ROW(Sheet2!$A:$B)),ROW(1:1)),2))),"",INDEX(Sheet2!$A:$B,SMALL(IF(Sheet2!$A:$B=$A$29,ROW(Sheet2!$A:$B)),ROW(1:1)),2))
but it doesn't like that either.
What is going on?
Is there a better way to Macro some array formulae?
Bookmarks