Hi All,
I'm trying to put together a macro that will copy the value from column H in same row of my active cell, then search another sheet for that value. If the value is found, I would like it to highlight the entire row, if not, then I would like a message box to return "Not Found"
Here is what I have so far.
Currently, it will successfully run if it finds a match. If it does not find a match it provides a "Runtime error '91: Object variable or With block variable not set" if the value is not found on the second sheet. Is there a way for it to search using the value in column H based on the row I am in without needing to be in that cell? How can I re-write to stop providing an error when a matching value is not found?
Thanks in advance!
I'm trying to put together a macro that will copy the value from column H in same row of my active cell, then search another sheet for that value. If the value is found, I would like it to highlight the entire row, if not, then I would like a message box to return "Not Found"
Here is what I have so far.
VBA Code:
Sub SearchTest()
Rng = ActiveCell.Value
Application.ScreenUpdating = False
Sheets("Open but Delinquent").Select
Columns("H:H").Select
Cells.Find(What:=Rng, After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
ActiveCell.Select
Selection.EntireRow.Select
Application.ScreenUpdating = True
End Sub
Currently, it will successfully run if it finds a match. If it does not find a match it provides a "Runtime error '91: Object variable or With block variable not set" if the value is not found on the second sheet. Is there a way for it to search using the value in column H based on the row I am in without needing to be in that cell? How can I re-write to stop providing an error when a matching value is not found?
Thanks in advance!