“Ctrl+F” and a value gives an output. For more entries click “Find Next” and repeat thid until the right content appears.
I try to do this with an example file “cars.xls” and the following macro:
Sub search()
Dim InputValue As String
Dim Rng As Range
InputValue = InputBox("Enter a search item")
With Sheets("Sheet1").Range("A:F")
Set Rng = .Find(What:=InputValue, _
LookIn:=xlValues, _
LookAt:=xlPart, _
SearchOrder:=xlByColumns, _
SearchDirection:=xlNext)
Cells.FindNext(After:=ActiveCell).Activate
If Not Rng Is Nothing Then
Application.Goto Rng, True
Else
MsgBox "Nothing found"
End If
End With
End Sub
When I enter the value “Peugeot” it shows only 1 result and then it stops. There is no button “Find Next” to click. In the example file there are 4 hits for the value “Peugeot”.
What is going wrong with this macro?
Thanks for your help
Bookmarks