In column A I have numbers stored as text from "0000" to "2000", and in column B I have numbers stored as text that I want to find the row# for in col A. For example, "0932" and "1040".
Using this:
a = Application.WorksheetFunction.Match(k, Range("a1:a2000"), 0)
where k is a value from col b, a would be the row that the value from col b, appears in col a.
I get a match for anything from "0000" to "0999", but when I go to "1000" or above I get the "Unable to get Match property of Worksheetfunction class" error.
Here's the whole code for the problem I'm talking about.
Sub test()
Dim k As String
For i = 1 To 5
k = Cells(i, 2).Text
a = Application.WorksheetFunction.Match(k, Range("a1:a2000"), 0)
Cells(i + 1, 5) = a
Next i
End Sub
ideas? Please keep it as basic as possible as I'm just a novice.
Thanks!
Using this:
a = Application.WorksheetFunction.Match(k, Range("a1:a2000"), 0)
where k is a value from col b, a would be the row that the value from col b, appears in col a.
I get a match for anything from "0000" to "0999", but when I go to "1000" or above I get the "Unable to get Match property of Worksheetfunction class" error.
Here's the whole code for the problem I'm talking about.
Sub test()
Dim k As String
For i = 1 To 5
k = Cells(i, 2).Text
a = Application.WorksheetFunction.Match(k, Range("a1:a2000"), 0)
Cells(i + 1, 5) = a
Next i
End Sub
ideas? Please keep it as basic as possible as I'm just a novice.
Thanks!