Skip to main content

Range.PivotTable property

Table of contents
  1. Syntax
  2. Example

Returns a PivotTable object that represents the PivotTable report containing the upper-left corner of the specified range.

Syntax

expression.PivotTable

expression A variable that represents a Range object.

Example

This example sets the current page for the PivotTable report on Sheet1 to the page named Canada.

Set pvtTable = Worksheets("Sheet1").Range("A3").PivotTable 
pvtTable.PivotFields("Country").CurrentPage = "Canada"

This example determines the PivotTable report associated with the Sales chart on the active worksheet, and then it sets the page named Oregon as the current page for the PivotTable report.

Set objPT = ActiveSheet.Charts("Sales").PivotLayout.PivotTable
objPT.PivotFields("State").CurrentPageName = "Oregon"

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>