Ashish Batham
Member
I want to search for the text in an excel spreadsheet with help of an input box.
Once the text is found that cell should be highlighted
Also, all the cell should be highlighted which has that text
if not match found a message should prompte "No match found"
Thanks.
I have created a codem but unfortunately not working
Sub snsearch()
Dim Rng As Range
Dim c As Range
Dim varUserInput As Variant
On Error GoTo err_handler
varUserInput = InputBox("Please enter the Serial number you wish to find", _
"Laser Serial Number", "")
Set Rng = Range("J3:J" & Range("J65536").End(xlUp).Row)
Cells.Find(What:=varUserInput, After:=ActiveCell, LookIn:=xlFormulas, LookAt:= _
xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False) _
.Activate
Exit Sub
err_handler:
MsgBox "No Matching Serial Number has been found, please try again! "
End Sub
Once the text is found that cell should be highlighted
Also, all the cell should be highlighted which has that text
if not match found a message should prompte "No match found"
Thanks.
I have created a codem but unfortunately not working
Sub snsearch()
Dim Rng As Range
Dim c As Range
Dim varUserInput As Variant
On Error GoTo err_handler
varUserInput = InputBox("Please enter the Serial number you wish to find", _
"Laser Serial Number", "")
Set Rng = Range("J3:J" & Range("J65536").End(xlUp).Row)
Cells.Find(What:=varUserInput, After:=ActiveCell, LookIn:=xlFormulas, LookAt:= _
xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False) _
.Activate
Exit Sub
err_handler:
MsgBox "No Matching Serial Number has been found, please try again! "
End Sub