Share via


SlicerPivotTables.RemovePivotTable Method (Excel)

Removes a reference to a PivotTable from the SlicerPivotTables collection.

Version Information

Version Added: Excel 2010

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, is no longer filtered by its parent SlicerCache 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")

See Also

Concepts

SlicerPivotTables Object

SlicerPivotTables Object Members