Name

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

Synopsis

Creates a pivot table in the workbook.

Argument

Settings

SourceType

One of these settings: xlConsolidation, xlDatabase (default), xlExternal, xlPivotTable.

SourceData

Any of a number of possible sources, such as a Range object, an array of ranges, the name of another pivot table, or an array of strings containing the SQL query string.

TableDestination

A Range object indicating where to place the pivot table. The default is the active range.

TableName

A name for the pivot table.

RowGrand

True displays grand totals for rows; False does not.

ColumnGrand

True displays grand totals for columns; False does not.

SaveData

True saves the data with the pivot table; False saves only the pivot table definition.

HasAutoFormat

True applies automatic formatting to the pivot table; False does not.

AutoPage

If SourceType is xlConsolidation, True automatically creates page field; False does not.

Reserved

Not used.

BackgroundQuery

True performs the query asynchronously in the background; False performs the query synchronously.

OptimizeCache

True optimizes the pivot cache; False does not (default).

PageFieldOrder

One of these settings: xlDownThenOver or xlOverThenDown

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.