Udostępnij za pośrednictwem


SlicerPivotTables.AddPivotTable Method (Excel)

Adds a reference to a PivotTable to the SlicerPivotTables collection.

Version Information

Version Added: Excel 2010

Syntax

expression .AddPivotTable(PivotTable)

expression A variable that represents a SlicerPivotTables object.

Parameters

Name

Required/Optional

Data Type

Description

PivotTable

Required

PivotTable

A PivotTable object that represents the PivotTable to add.

Return Value

Nothing

Remarks

When a PivotTable is added to the SlicerPivotTables collection, it can be filtered by its parent SlicerCache and the slicers associated with it.

Example

The following code example adds PivotTable1 to the slicer cache associated with the Customer slicer.

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

See Also

Concepts

SlicerPivotTables Object

SlicerPivotTables Object Members