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

Related Article

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

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.