AllowFiltering Property

Microsoft Office Web Components Object Model

Show All

AllowFiltering Property

       

AllowFiltering property as it applies to the Protection object.

Determines whether AutoFilter can be enabled or disabled when the worksheet has been protected. This property has no effect if the Protection object’s Enabled property is set to False. Setting this property to True disables the command on the toolbar. Users can still filter data if AutoFilter is enabled before this property is set to False. Read/write Boolean.

expression.AllowFiltering

expression   Required. An expression that returns a Protection object.

AllowFiltering property as it applies to the PivotTable object.

Determines whether a field an be added to or removed from the filter area of a PivotTable list, and whether the AutoFilter command on the toolbar is enabled. The default value is True. Read/write Boolean.

expression.AllowFiltering

expression   Required. An expression that returns a PivotTable object.

Example

As it applies to the Protection object.

This example locks all cells on Sheet1, enables the insertion and deletion of columns, disables the AutoFilter command on the toolbar, and then protects Sheet1.

Sub Protect_Worksheet()
    Dim ptProtSheet1

    'Lock all cells on the worksheet.
    Spreadsheet1.Worksheets("Sheet1").Cells.Locked = True
   
    Set ptProtSheet1 = Spreadsheet1.Worksheets("Sheet1").Protection
   
    ' Allows user to delete columns while Sheet1 is protected.
    ptProtSheet1.AllowDeletingColumns = True
   
    ' Allows user to insert columns while Sheet1 is protected.
    ptProtSheet1.AllowInsertingColumns = True
   
    ' Disable the AutoFilter command on the toolbar.
    ptProtSheet1.AllowFiltering = False
   
    ' Protect Sheet1.
    ptProtSheet1.Enabled = True
End Sub

As it applies to the PivotTable object.

This example disables filtering for the PivotTable list.

PivotTable1.AllowFiltering = False