AutoFilter is applicable to a column or a set of columns. It filters data depending on the given criteria. The filter displays a certain number of lines based on defined criteria.


expression .AutoFilter(Field, Criteria1, Operator, Criteria2, VisibleDropDown)


Field– It is an integer offset of the field which contains the Filter. The data type is variant, which means it can hold any Data types – integers, strings, date and so on.

Criteria1– It’s a condition based on which columns are selected.

Operator– It specifies the type of filter.

Example 1: To Close All Existing AutoFilters and Create New AutoFilters

Sub AutoFilter1()

With ActiveSheet

‘Turns off any existing AutoFilters if any..

.AutoFilterMode = False

‘ Now apply AutoFilter to a Range


End With

End Sub

Example 2: Using AutoFilter to match single criteria

Sub FilterTo1Criteria()

With Sheet1

.AutoFilterMode = False


.Range(“A1:C1″).AutoFilter Field:=2, Criteria1:=”North”

End With

End Sub

author image

About admin

You Might Also Like...

The While loop
WordPress Training in gurgaon
Hirdesh Bhardwaj
The FOR Loop


  1. Great items from you, man. I’ve understand your stuff prior to and you are simply too great.
    I actually like what you’ve got here, certainly like what you are saying and the best way wherein you are saying it.
    You make it enjoyable and you continue to take care of to stay it sensible.
    I cant wait to learn much more from you. This is actually a great web site.

  2. May I just say what a comfort to discover a person that really understands what they’re discussing on the internet.
    You definitely know how to bring a problem to light and make it important.

    More and more people ought to check this out and understand this side of
    your story. I can’t believe you’re not more popular since you surely possess the gift.

  3. Admiring the time and energy you put into your website and
    detailed information you present. It’s great to come across
    a blog every once in a while that isn’t the same old rehashed material.
    Fantastic read! I’ve bookmarked your site and I’m including your RSS feeds to my Google account.

Leave a Reply

Your email address will not be published.

Enjoy the tutorial? Please spread the word :)

Follow by Email