Suppose I want to use Evaluate function to evaluate an array formula which returns a range of values. For example I try to get index (using Excel function MATCH) in an ordered list in Sheet2!A:A for each values in Sheet1!A:A. And I want to put the indices in column B.
Dim sh as Worksheet
Set sh = Sheets("Sheet1")
sh.Range("B1:B10").Value = sh.Evaluate("=MATCH(A1:A10,Sheet2!A:A)")
Whan I run the code, I get a column of repeated values - the values are equal to the index of the first element. This is not correct.
When I try the same by putting array formula in the worksheet {=MATCH(A1:A10,Sheet2!A:A)}, it works without problems and returns the correct index for every element.
So my question: how to use Evaluate function returning a whole range of values?
Evaluate("=TRANSPOSE(MATCH(A1:A10,Sheet2!A:A))")orApplication.Transpose(Evaluate("=MATCH(A1:A10,Sheet2!A:A)"))- Dmitry Pavliv