Name

pivottable.PivotTableWizard([SourceType], [SourceData], [TableDestination], [TableName], [RowGrand], [ColumnGrand], [SaveData], [HasAutoFormat], [AutoPage], [Reserved], [BackgroundQuery], [OptimizeCache], [PageFieldOrder], [PageFieldWrapCount], [ReadData], [Connection])

Synopsis

Quickly creates a pivot table and returns a reference to the created PivotTable object.

Argument

Settings

SourceType

An xlPivotTableSourceType constant indicating the source of the data to use in the pivot table. Can be xlConsolidation, xlDatabase, xlExternal, or xlPivotTable.

SourceData

If SourceType is xlConsolidation, xlDatabase, or xlPivotTable, a Range object containing the source for the pivot table. If SourceType is xlExternal, an array containing the SQL query string used to retrieve the data for the pivot table.

TableDestination

The Range object indicating the location of the upper-left corner for the new pivot table.

TableName

A name to assign to the pivot table. Default is PivotTable n.

RowGrand

True displays grand totals for rows; False omits row totals. Default is True.

ColumnGrand

True displays grand totals for columns; False omits column totals. Default is True.

SaveData

If SourceType is xlExternal, True reads all of the fields from the data source and False delays retrieving the data until the pivot cache is refreshed. Default is True.

HasAutoFormat

True automatically adjusts column widths when the pivot table is refreshed; False preserves column widths ...

Get Programming Excel with VBA and .NET now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.