The application of VBA in Excel (Ii.)

Source: Internet
Author: User
Tags range

Directory

AutoFilter

Binding

Cell Comments

Cell Copy

Cell Format

Cell number Format

Cell Value

Cell

AutoFilter

1. Confirm that the current worksheet has automatic filtering enabled

Sub filter()
If ActiveSheet.AutoFilterMode Then
MsgBox "Turned on"
End If
End Sub

When cells in a worksheet use the AutoFilter feature, the AutoFilterMode value of the worksheet will be true or false.

2. Using the Range.autofilter method

Sub Test()
Worksheets("Sheet1").Range("A1").AutoFilter _
field:=1, _
Criteria1:="Otis"
VisibleDropDown:=False
End Sub

This is an example of an Excel Help document that filters out cells that have values of Otis starting at cell A1. The Range.autofilter method can be either with parameters or without parameters. When no arguments are taken, the Filter menu command is displayed in the range specified by the Range object, that is, only one AutoFilter Drop-down arrow appears. In this case, if you execute the Range.autofilter method again, you can remove the AutoFilter, and when you have parameters, you can filter data within the range specified by the Range object based on the given parameters, displaying only the data that matches the filter criteria. The parameter field is the integer offset of the Filter datum field, together with the Criterial1, operator, and Criterial2 three parameters, the last parameter Visibledropdown specifies whether to display the AutoFilter drop-down arrows.

Where field parameters may not be very well understood, here's a note:

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.