USing Match on 2D array
Hopefully you have discovered by now that that matches on column 1 of the
array, not column 2 as you asked.
Sub abc()
Dim v As Variant
ReDim v(0 To 3, 0 To 1)
For i = 0 To 3
v(i, 0) = i + 1
v(i, 1) = Chr(i + 65)
Next
x = "C"
res = Application.Match(x, Application.Index(v, 0, 2), 1)
Debug.Print res, Application.Index(v, res, 2)
End Sub
Produces
3 C
for me. (3 being the index into the second column of the 2D array. )
--
Regards,
Tom Ogilvy
"ExcelMonkey" wrote:
Got it.
Application.Match(x, Application.Index(OrigViewNames, 0, 1), 1)
"ExcelMonkey" wrote:
Can someone please remind me how to use match on a 2d array ("OrigViewNames")
if i am looking to return the position of a value (x) in the second column of
the array.
This does not work:
Application.Match(x, OrigViewNames, 0)
What do I have to put after the OrigViewNames to indicate column 2.
Thanks
EM
|