PivotFilters.Add Method
Adds new filters to the PivotFilters collection.
Version Information
Version Added: Excel
Syntax
expression.Add(Type, DataField, value1, Value2, Order, Name, Description, IsMemberPropertyFilter, MemberPropertyField)
expression A variable that represents a PivotFilters object.
Parameters
| Name | Required/Optional | Data Type | Description |
|---|---|---|---|
| Type | Required | XlPivotFilterType | Requires an XlPivotFilterType type of filter. |
| DataField | Optional | Variant | The field to which the filter is attached. |
| Value1 | Optional | Variant | Filter value 1. |
| Value2 | Optional | Variant | Filter value 2. |
| Order | Optional | Variant | Order in which the data should be filtered. |
| Name | Optional | Variant | Name of the filter. |
| Description | Optional | Variant | A brief description of the filter. |
| MemberPropertyField | Optional | Variant | Specifies the member property field on which the label filter is based. |
Return Value
PivotFilter
Example
Following are some examples of how to use the Add function correctly.
| Visual Basic for Applications |
|---|
|
The following example returns a run-time error because the data type of Value1 is invalid.
| Visual Basic for Applications |
|---|
|