Skip to main content

Worksheet.PivotTables method

Returns an object that represents either a single PivotTable report (a PivotTable object) or a collection of all the PivotTable reports (a PivotTables object) on a worksheet. Read-only.

Syntax

expression.PivotTables (Index)

expression A variable that represents a Worksheet object.

Parameters

Name Required/Optional Data type Description
Index Optional Variant The name or number of the report.

Return value

Object

Example

This example sets the Sum of 2022 field in the first PivotTable report on the active sheet to use the SUM function.

ActiveSheet.PivotTables("PivotTable1").PivotFields("Sum of 2022").Function = xlSum

Leave a comment

Your email address will not be published. Required fields are marked *

Format your code: <pre><code class="language-vba">place your code here</code></pre>