SlicerPivotTables.RemovePivotTable method (Excel)

Removes a reference to a PivotTable from the SlicerPivotTables collection.

Syntax

expression.RemovePivotTable (PivotTable)

expression A variable that represents a SlicerPivotTables object.

Parameters

Name Required/Optional Data type Description
PivotTable Required Variant A PivotTable object that represents the PivotTable to remove, or the name or index of the PivotTable in the collection.

Return value

Nothing

Remarks

When a PivotTable is removed from the SlicerPivotTables collection, it is no longer filtered by its parent SlicerCache object and the slicers associated with it.

Example

The following code example removes PivotTable1 from the slicer cache associated with the Customer slicer.

Dim pvts As SlicerPivotTables 
Set pvts = ActiveWorkbook.SlicerCaches("Slicer_Customer").PivotTables 
pvts.RemovePivotTable("PivotTable1")

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.