Is there a way to get VBA to except Array formulas with INDEX MATCH when using a .worksheetfunction?
My first formula works since it's not an array I presume?
This code works
Dim VType As string
VType = Application.WorksheetFunction.Index(Sheets(sheetname).Range("$B:$B"), Application.WorksheetFunction.Match("*" & VendorCode & "*", Sheets(sheetname).Range("$A:$A"), 0), 1)
But then when I add a 2nd match I get an arror: Type mismatch
Dim RetORWaste As String
RetORWaste = Application.WorksheetFunction.Index(Sheets(wsMaster.Name).Range("$F:$F"), Application.WorksheetFunction.Match(("*" & VendorCode & "*") & ("*" & VRegion & "*"), (Sheets(wsMaster.Name).Range("$B:$B")) & (Sheets(wsMaster.Name).Range("$C:$C")), 0), 1)
Both sheetname and wsMaster.name are string. The wsMaster.Name also gets the correct sheetname. So it must be the array?
(Sheets(wsMaster.Name).Range("$B:$B")) & (Sheets(wsMaster.Name).Range("$C:$C"))is trying to concatenate two arrays... which you can't do and will throw a type mismatch. You could useEvaluatehere.evaluatebut not sure where in the formula to add it in my case?RetORWaste = wsMaster.Evaluate("yourformulaasastringminustheleadingequals")