数据透视表对象 (Excel)PivotTable object (Excel)

代表工作表上的数据透视表。Represents a PivotTable report on a worksheet.

注解Remarks

PivotTable 对象是 PivotTables 集合的成员。The PivotTable object is a member of the PivotTables collection. PivotTables 集合包含某一张工作表上的所有 PivotTable 对象。The PivotTables collection contains all the PivotTable objects on a single worksheet.

由于数据透视表编程可能很复杂, 因此记录数据透视表操作并修改记录的代码通常是最简单的。Because PivotTable report programming can be complex, it's generally easiest to record PivotTable report actions and then revise the recorded code.

示例Example

使用**数据** 透视__ 表 (索引), 其中_索引_是数据透视表的索引号或名称, 返回单个数据透视表对象。Use PivotTables (index), where index is the PivotTable index number or name, to return a single PivotTable object.

以下示例将 Sheet3 上第一个数据透视表中的 "Year" 字段设为 "Year a row" 字段。The following example makes the field named Year a row field in the first PivotTable report on Sheet3.

Worksheets("Sheet3").PivotTables(1) _ 
 .PivotFields("Year").Orientation = xlRowField

方法Methods

属性Properties

另请参阅See also

支持和反馈Support and feedback

有关于 Office VBA 或本文档的疑问或反馈?Have questions or feedback about Office VBA or this documentation? 请参阅 Office VBA 支持和反馈,获取有关如何接收支持和提供反馈的指南。Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.