I have to private sub worksheet changes.
One is to filter data by cell C2 and the other is to filter by cell F2. Each looks to filter via different columns. I got these codes elsewhere, does anyone know how to run them both as its giving me an error when searching from cell F2. It highlights the 2nd private Sub statement.
One is to filter data by cell C2 and the other is to filter by cell F2. Each looks to filter via different columns. I got these codes elsewhere, does anyone know how to run them both as its giving me an error when searching from cell F2. It highlights the 2nd private Sub statement.
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If (Intersect(Target, Range("C2")) Is Nothing) _
Then
Exit Sub
End If
Cells.AutoFilter Field:=4, Criteria1:="=" & Range("C2")
End Sub
Private Sub Worksheet_Change(ByVal Target As Range)
If (Intersect(Target, Range("F2")) Is Nothing) _
Then
Exit Sub
End If
Cells.AutoFilter Field:=13, Criteria1:="=" & Range("F2")
End Sub
Last edited by a moderator: