Hi,
I'm hung up on something that seems so simple! As part of a larger process, I want to find the row that contains a value in column A that corresponds with the information in another cell. I did some searching and found this code:
Public Function GetRowNum(SheetName As String, SearchVal As String) As Long
GetRowNum = Sheets(SheetName).Columns(1).Cells.Find(SearchVal).Row
End Function
Sub FindRow()
Dim MyRow As Long
MyRow = GetRowNum("Db", "3650")
Range("A" & MyRow).Select
End Sub
This works great if one manually enters the value being searched for (the "3650" above), however I want to use the contents of cell B2 where the "3650" is. I've played around with this but haven't found the right combination I'd appreciate your help.
I'm hung up on something that seems so simple! As part of a larger process, I want to find the row that contains a value in column A that corresponds with the information in another cell. I did some searching and found this code:
Public Function GetRowNum(SheetName As String, SearchVal As String) As Long
GetRowNum = Sheets(SheetName).Columns(1).Cells.Find(SearchVal).Row
End Function
Sub FindRow()
Dim MyRow As Long
MyRow = GetRowNum("Db", "3650")
Range("A" & MyRow).Select
End Sub
This works great if one manually enters the value being searched for (the "3650" above), however I want to use the contents of cell B2 where the "3650" is. I've played around with this but haven't found the right combination I'd appreciate your help.