I have two worksheets containing some address information:
Sheet1 (ssheet)
Col A = Street Number
Col B = Street Name
Col C = Status
Sheet2 (tsheet)
Col A = Street Number
Col B = Street Name
Col C = initially empty, but should be filled in with data from Sheet1.ColC if the combination of Sheet1.ColA & Sheet1.ColB (concatenating them) are a match to Sheet2.ColA & Sheet2.ColB
I am hoping to do this via Match (in VBA), and not looping through all of the rows multiple times, but I have his a wall. Here is what I have so far:
I *think* it all works, except where I am trying to compare the concatenated Ax & Bx (for argument's sake, let's say that equates to "123Main Street" with the concatenated Ranges A2:Ax & B2:Bx which, if that combination exists, should also equate to "123Main Street", but it's not doing it that way. (I get a "Type Mismatch" error.
Any thoughts on what I might be missing?
Thank you so much for any help!
Sheet1 (ssheet)
Col A = Street Number
Col B = Street Name
Col C = Status
Sheet2 (tsheet)
Col A = Street Number
Col B = Street Name
Col C = initially empty, but should be filled in with data from Sheet1.ColC if the combination of Sheet1.ColA & Sheet1.ColB (concatenating them) are a match to Sheet2.ColA & Sheet2.ColB
I am hoping to do this via Match (in VBA), and not looping through all of the rows multiple times, but I have his a wall. Here is what I have so far:
VBA Code:
For x = 2 To Targetlastrow ' last row in sheet
tsheet.Range("C" & x).Value = Application.Index(ssheet.Range("C2:C" & x), Application.Match(tsheet.Range("A" & x).Value & tsheet.Range("B" & x).value, ssheet.Range("A2:A" & x) & ssheet.Range("B2:B" & x), 0))
'' values to return what to match compare against
Next
I *think* it all works, except where I am trying to compare the concatenated Ax & Bx (for argument's sake, let's say that equates to "123Main Street" with the concatenated Ranges A2:Ax & B2:Bx which, if that combination exists, should also equate to "123Main Street", but it's not doing it that way. (I get a "Type Mismatch" error.
Any thoughts on what I might be missing?
Thank you so much for any help!