EnableAutoFilter Property

Microsoft Office Web Components Visual Basic

True if the specified worksheet can be filtered. This property has no effect if the Protection Enabled property is set to False. Read/write Boolean.

expression.EnableAutoFilter

expression    Required. An expression that returns a Worksheet object.

Example

This example enables AutoFilter for the active worksheet, and then protects the worksheet in Spreadsheet1.

Sub ProtectWorksheet_EnableAutoFilter
    Spreadsheet1.ActiveSheet.EnableAutoFilter = True
    Spreadsheet1.ActiveSheet.Protection.Enabled = True
End Sub