Here are two macros you could assign to buttons. One to search for the prompted search term and the other to reset and show all the data again.
Sub Find_All()
Dim Found As Range, rngAll As Range, FirstFound As String, strSearchTerm As String
strSearchTerm = Application.InputBox("Enter the search term.", "Search Term", Type:=2)
If strSearchTerm = "False" Then Exit Sub 'User canceled
Rows.Hidden = False
Set Found = Cells.Find(What:=strSearchTerm, _
LookIn:=xlValues, _
LookAt:=xlPart, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False)
If Not Found Is Nothing Then
FirstFound = Found.Address
Set rngAll = Found
Do
Set Found = Cells.FindNext(After:=Found)
If Found.Address <> FirstFound Then Set rngAll = Union(rngAll, Found)
Loop While Found.Address <> FirstFound
Application.ScreenUpdating = False
rngAll.Select
Set rngAll = Union(rngAll, Rows("1:4")) 'Header rows
ActiveSheet.UsedRange.Rows.Hidden = True
rngAll.EntireRow.Hidden = False
Application.ScreenUpdating = True
Else
MsgBox "No match found for '" & strSearchTerm & "'.", vbExclamation, "No Match Found"
End If
End Sub
Sub Show_All()
Rows.Hidden = False
End Sub
Bookmarks