If you doubleclick "ThisWorkbook" in vba editor and paste this code, it will work for all sheets when you change the value of B1:
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
Dim lr As Long
Dim i As Long
If Not Intersect(Target, Sh.Range("B1")) Is Nothing Then
Sh.Cells.EntireRow.Hidden = False
lr = Sh.Range("A" & Rows.Count).End(xlUp).Row
For i = 2 To lr
If Sh.Range("A" & i).Value <> Sh.Range("B1").Value Then Sh.Range("A" & i).EntireRow.Hidden = True
If Sh.Range("A" & i).Value = Sh.Range("B1").Value Then Sh.Range("A" & i).EntireRow.Hidden = False
Next i
End If
End Sub
Bookmarks