You need to put your code in the worksheet module, Selection Change event.
Copy and paste the code below to the worksheet module, which you can quickly access by right-clicking on the sheet tab and selecting View Code from the context menu.
VB:Private Sub Worksheet_SelectionChange(ByVal Target As Range) ActiveSheet.AutoFilterMode = False Range("A3:D3").AutoFilter Range("A3:D3").AutoFilter Field:=2, Criteria1:=Range("A2").Text End Sub



Bookmarks