ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   USing Match on 2D array (https://www.excelbanter.com/excel-programming/386180-re-using-match-2d-array.html)

ExcelMonkey

USing Match on 2D array
 
Thanks, I changed my criteria before I posted the second post. Missed that
inthe repsonse.

EM

"Tom Ogilvy" wrote:

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



All times are GMT +1. The time now is 05:15 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com