Microsoft Office Tutorials and References
In Depth Information
PivotTables Collection
The PivotTables collection contains the set of all PivotTables in a particular worksheet.
Table 16-1 lists the key properties and methods for the PivotTables collection. You can
access the PivotTables property from a Wo rksheet object using the following code:
ActiveSheet.PivotTables(1)
Table 16-1. Key Properties and Methods of the PivotTables Collection
Property/Method
Description
Add(PivotCache,
TableDestination, TableName,
ReadData, DefaultVersion)
Method: adds a new PivotTable to the collection.
PivotCache refers to the data that will be displayed in the
PivotTable; TableDestination passes a Range object
whose upper-left corner marks the location of the
PivotTable in the worksheet; Ta bleName contains the
name of the PivotTable (optional); ReadData , when True ,
caches all records from an external database in
PivotCache ; DefaultVersion specifies the version of Excel
that created the PivotTable.
Count
Property (read-only): returns the number of items in the
PivotTables collection.
Item(index)
Method: returns the PivotTable object reference
associated with index . Index may refer to the PivotTable
by either its name or its relative position in the
collection.
PivotTable Object
The PivotTable object represents a single PivotTable. You can use this object to access an exist­
ing PivotTable on a worksheet, or you can use the Add method from the PivotTables collec­
tion to add a new one. You can even use the PivotTableWizard method from the Wo rksheet
object to create a new PivotTable.
Table 16-2 contains a list of the key properties and methods associated with the PivotTable
object.
Search JabSto ::




Custom Search