Excel Criteria1 Instance

Source: Internet
Author: User

The Criteria1 usages of Excel are used in combination with VBA, and here are a few examples of Criteria1 usage, which I hope will help you.

Sub Simpleorfilter ()

Worksheets ("SalesReport"). Select

Range ("A1"). AutoFilter

Range ("A1"). AutoFilter field:=4,criteria1:= "=a", Operator:=xlor, criteria2:= "=b"

End Sub

Sub Simpleandfilter ()

Worksheets ("SalesReport"). Select

Range ("A1"). AutoFilter

Range ("A1"). AutoFilter field:=4, _

Criteria1:= ">=a", _

Operator:=xland, criteria2:= "<=ezz"

End Sub

Sub Top10filter ()

' Top Revenue Records

Worksheets ("SalesReport"). Select

Range ("A1"). AutoFilter

Range ("A1"). AutoFilter field:=6, criteria1:= "a", Operator:=xltop10items

End Sub

Sub Multiselectfilter ()

Worksheets ("SalesReport"). Select

Range ("A1"). AutoFilter

Range ("A1"). AutoFilter field:=4, Criteria1:=array ("A", "C", "E", "F", "H"), operator:=xlfiltervalues

End Sub

Sub Dynamicautofilter ()

Worksheets ("SalesReport"). Select

Range ("A1"). AutoFilter

Range ("A1"). AutoFilter field:=3,criteria1:=xlfilternextyear,operator:=xlfilterdynamic

End Sub

Sub Filterbyicon ()

Worksheets ("SalesReport"). Select

Range ("A1"). AutoFilter

Range ("A1"). AutoFilter field:=6, _

Criteria1:=activeworkbook.iconsets (Xl5arrowsgray). Item (5), Operator:=xlfiltericon

End Sub

Sub Filterbyfillcolor ()

Worksheets ("SalesReport"). Select

Range ("A1"). AutoFilter

Range ("A1"). AutoFilter field:=6, Criteria1:=rgb (255, 0, 0), Operator:=xlfiltercellcolor

End Sub

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.