LancashirePoacher
New Member
- Joined
- Oct 1, 2024
- Messages
- 5
- Office Version
- 365
- Platform
- Windows
Seen many close answers to my simple question, but is there an elegant way to use the Application.Match function for 2 criteria to match against 2 columns
key1 = "QI"
key2 = "Episode"
keycol1 = 2
keycol2 = 6
application.match on 1 criteria works perfectly
row = Application.Match(key1, ActiveSheet.Columns(keycol1), 0)
but
row = Application.Match(key1&key2, ActiveSheet.Columns(keycol1) & ActiveSheet.Columns(keycol2), 0)
fails error 2029 - trying to concatentate two ranges?
I can get it to work using Evaluate
row = Evaluate("MATCH(""" & key1 & """&""" & key2 & """, $B$2:$B$500 & $F$2:$F$500, 0)")
but its not very elegant and probably slower.
key1 = "QI"
key2 = "Episode"
keycol1 = 2
keycol2 = 6
application.match on 1 criteria works perfectly
row = Application.Match(key1, ActiveSheet.Columns(keycol1), 0)
but
row = Application.Match(key1&key2, ActiveSheet.Columns(keycol1) & ActiveSheet.Columns(keycol2), 0)
fails error 2029 - trying to concatentate two ranges?
I can get it to work using Evaluate
row = Evaluate("MATCH(""" & key1 & """&""" & key2 & """, $B$2:$B$500 & $F$2:$F$500, 0)")
but its not very elegant and probably slower.