dversloot1
Board Regular
- Joined
- Apr 3, 2013
- Messages
- 113
I'm trying to get the ROW number from a specific sheet where a cell value has been found.
Cnt = 5
ID = 479
Row = 0 --> This should return 19 but for some reason it is returning a 0.
My code is:
Private Sub CommandButton1_Click()
Dim ID As Variant
Dim Row As Long
Dim Cnt As Long
Dim Analyst As String
Cnt = InStr(1, ListBox2.Value, "-")
ID = Trim(Left(ListBox2.Value, Cnt - 1))
On Error Resume Next
Row = Application.WorksheetFunction.Match(ID, Sheets("Data").Range("B1:B2000"), 0)
On Error GoTo 0
Analyst = "A" & Row
Sheets("Sheet1").Range("B4").Value = Sheets("Data").Range(Analyst).Value
End Sub
Anyone know why this is the case?
Cnt = 5
ID = 479
Row = 0 --> This should return 19 but for some reason it is returning a 0.
My code is:
Private Sub CommandButton1_Click()
Dim ID As Variant
Dim Row As Long
Dim Cnt As Long
Dim Analyst As String
Cnt = InStr(1, ListBox2.Value, "-")
ID = Trim(Left(ListBox2.Value, Cnt - 1))
On Error Resume Next
Row = Application.WorksheetFunction.Match(ID, Sheets("Data").Range("B1:B2000"), 0)
On Error GoTo 0
Analyst = "A" & Row
Sheets("Sheet1").Range("B4").Value = Sheets("Data").Range(Analyst).Value
End Sub
Anyone know why this is the case?