Hi,
I've browsed through multiple threads with varying situations and answers, but cant quite get this to work. So I've decided to post my particular situation if anyone has ideas. I am looking to find the row on a Worksheet based on two criteria taken from Text Boxes on a User Form. "Criteria1" should be searched for in Column A and the "Criteria2" should searched for in Column B of the Worksheet. "matchRow" would then be the row number on the sheet where both are true.
I am getting error 2029 for the matchRow. I am assuming I don't have the syntax right for Evaluate but don't know enough about Evaluate to correct it. Thanks if you can help!
I've browsed through multiple threads with varying situations and answers, but cant quite get this to work. So I've decided to post my particular situation if anyone has ideas. I am looking to find the row on a Worksheet based on two criteria taken from Text Boxes on a User Form. "Criteria1" should be searched for in Column A and the "Criteria2" should searched for in Column B of the Worksheet. "matchRow" would then be the row number on the sheet where both are true.
VBA Code:
Dim aaoWS As Worksheet
Set aaoWS = ThisWorkbook.Worksheets("AAO")
' Criteria
Dim criteria1 As String, criteria2 As String
criteria1 = TextBox1.Value
criteria2 = TextBox2.Value
' Ranges
Dim rng1 As Range, rng2 As Range
Set rng1 = aaoWS.Range("A:A")
Set rng2 = aaoWS.Range("B:B")
' Match Row
matchRow = Evaluate("MATCH(1,(criteria1=rng1)*(criteria2=rng2),0)")
MsgBox "Row " & matchRow
I am getting error 2029 for the matchRow. I am assuming I don't have the syntax right for Evaluate but don't know enough about Evaluate to correct it. Thanks if you can help!