Hello everybody,
I am trying to make a function that will pop up an input window where the user should give a string. Then i want to activate (select) the row(s) that the string was found. The search takes place only in col A
this is some code i found, and mess with it. Problem is that it only gets the first result. Any help would be gratefull
I am trying to make a function that will pop up an input window where the user should give a string. Then i want to activate (select) the row(s) that the string was found. The search takes place only in col A
this is some code i found, and mess with it. Problem is that it only gets the first result. Any help would be gratefull
Code:
Dim sMessage As String
Dim sTitle As String
Dim sResponse As String
sMessage = "Enter string"
sTitle = "Search using name column"
FindString = InputBox(sMessage, sTitle)
If Trim(FindString) <> "" Then
With Sheets("sheet1").Range("A:A")
Set Rng = Cells.Find(What:=FindString, _
After:=.Cells(.Cells.Count), _
LookIn:=xlValues, _
LookAt:=xlWhole, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False)
If Not Rng Is Nothing Then
Application.Goto Rng, False
Else
MsgBox "no data found. sorry"
End If
End With
End If