Reputation: 131
I have a filtered list, and would like to roll back filter criteria depending on what is selected from the list box in cell C11. Because there are going to be multiple columns to filter, simply using .autofilter = false would not achieve the desired effect, as it would roll back all filters and not just for a given column. Is there a way to turn off a single columns filter?
If Target.Address = "$C$11" Then
If Range("C11").Value = "All" Then
With Sheets("Provider Front End")
.Range("B17:D17").AutoFilter field:=3, Critieria1:= 'turn off this single field?
End With
Else
With Sheets("Provider Front End")
.Range("B17:D17").AutoFilter
.Range("B17:D17").AutoFilter field:=3, Criteria1:=Range("C11").Value
End With
End If
End If
Upvotes: 0
Views: 2085
Reputation: 27249
To turn off a filter for a specific field leave the Criteria1
argument blank.
.Range("B17:D17").AutoFilter field:=3
For example, the following code takes the following steps:
12
14
12
on the first column.Example Code:
Range("A1:D6").AutoFilter 1, 12
Range("A1:D6").AutoFilter 2, 14
Range("A1:D6").AutoFilter 2
Upvotes: 2