Private Sub CommandButton1_Click()
Dim rng, sh As Worksheet
Dim WhatToFind As String
Dim foundCell As Range
Dim Ans As String
WhatToFind = Range("A12").Value ' "InputYourString" ' adjust to your needs ...
For Each sh In ActiveWorkbook.Worksheets
If Not sh.Name = "Front Page" Then
With sh
Set foundCell = .Range("B:B").Find(what:=WhatToFind, _
After:=.Range("B1"), _
LookIn:=xlFormulas, _
LookAt:=xlPart, _
SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False)
If Not (Nothing Is foundCell) Then
If foundCell.Row > 6 Then
Ans = MsgBox("Found on " & sh.Name & " at " & foundCell.Address _
& " Continue searching ? ", vbYesNo)
If Ans = vbNo Then Exit Sub
End If
End If
End With
End If
Next sh
End Sub
It looks like you chopped off the end of some of your code. If the above code finds WhatToFind on a sheet, it will ask you if you want to keep looking. (I wasn't sure what you wanted at that point because the posted code was truncated.) If you say YES, then it will look at the next sheet. This routine will not find two occurances on the same sheet. This can be easily changed.
I also removed some unneeded selecting and such. If you want to go to the found cell after pressing NO, replace the above line with
If Ans = vbNo Then sh.Activate: foundCell.Select: Exit Sub
Bookmarks