Hello,
Can you add a message box when I click "OK" from "Do you want to continue searching for XX" that when I click "OK" but if I am at the last search and it will say "This the end of your search" do you want to "exit" then "OK" "No" so I can start searching again.
Possbile?
Sub FindMe()
Dim Addx As String
Dim Cell As Range
Dim Choice As Integer
Dim Found As Boolean
Dim Rng As Range
Dim State As Long
Dim What As String
Dim Wks As Worksheet
' // Input can only be Text
What = InputBox(Prompt:="Please enter your search criteria", Title:="Search")
If What = "" Then Exit Sub
For Each Wks In ThisWorkbook.Worksheets
State = Wks.Visible
If State <> xlSheetVisible Then Wks.Visible = xlSheetVisible
DoEvents
Set Rng = Wks.UsedRange
Set Cell = Rng.Find(What, Rng.Cells(Rng.Rows.Count, Rng.Columns.Count), xlValues, xlPart, xlByRows, xlNext, False, False, False)
If Not Cell Is Nothing Then
Addx = Cell.Address
Found = True
Do
Cell.Parent.Activate
Cell.Select
Choice = MsgBox("Do you want to continue searching for """ & What & """?", _
vbQuestion + vbOKCancel)
'Choice = MsgBox("Do you want to continue searching?", vbQuestion + vbOKCancel)
If Choice = vbCancel Then Exit Sub
Set Cell = Rng.FindNext(Cell)
If Cell.Address = Addx Then Exit Do
Loop
End If
Wks.Visible = State
Next Wks
If Not Found Then
MsgBox "No matches were found for """ & What & """"
End If
End Sub
Bookmarks