Hi Everyone,
I have this excellent code that finds a SearchString in a list, which works great, except:
When it doesn't find the SearchString you have to click on the OK button 3 times to get rid of it.
Ideally one click would be a fix, or - bring back the Message Box for another search.
Any help appreciated as always.
I have this excellent code that finds a SearchString in a list, which works great, except:
When it doesn't find the SearchString you have to click on the OK button 3 times to get rid of it.
Ideally one click would be a fix, or - bring back the Message Box for another search.
Code:
Sub myfindV2()
Dim Message, Title, Default, SearchString
Message = "Enter the name you need to find.." & vbNewLine & "(not case sensitive)" ' Set prompt.
Title = "Find ? On all sheets!" ' Set title.
Default = "" ' Set default.
' Display message, title, and default value.
SearchString = InputBox(Message, Title, Default)
Set S = Sheets.Application
For Each S In Application.Sheets
With S.Range("A1:IV65536")
Set F = .Find(SearchString, MatchCase:=False, LookAt:=xlPart, LookIn:=xlValues)
If F Is Nothing Then
MsgBox "I can't see " & SearchString & " in the list!"
Else
Location = F.Address
S.Select
Range(Location).Select
Exit For
End If
End With
Next S
End Sub
Any help appreciated as always.