Clear the filter of a particular column

Viewed 35

How to clear the filter of a particular column using excel vba

filename is wsCopy, Column field is 100

1 Answers

If you want, you can specify filename and sheet name, or don't. In the shorter version, make sure to have the right sheet activated (clicked on):

'longer
Workbooks("wsCopy").Sheets([sheet_name]).Range([col:col]).AutoFilter Field:=100
        
'shorter - activate the right sheet
Range([col:col]).AutoFilter Field:=100

remember to fill in [sheet_name] and [col:col] - refering to columns with autofilter.

Example

I will use a smaller Range for simplicity.
Filter is applied to columns B:E and I wish to remove it from column D = 3rd column (counting from B).

I will assume the sheet is called "Data". Then the following code can be used:

'longer
Workbooks("wsCopy").Sheets("Data").Range("B:E").AutoFilter Field:=3

'shorter
Range("B:E").AutoFilter Field:=3

example of data with filter applied in column C

Related