透视字段对象 (Excel)PivotField object (Excel)

代表数据透视表中的一个字段。Represents a field in a PivotTable report.

说明Remarks

PivotField 对象是 PivotFields 集合的成员。The PivotField object is a member of the PivotFields collection. PivotFields 集合包含数据透视表中的所有字段,包括隐藏字段。The PivotFields collection contains all the fields in a PivotTable report, including hidden fields.

在某些情况下, 可能更易于使用返回数据透视表字段子集的属性之一。In some cases, it may be easier to use one of the properties that returns a subset of the PivotTable fields. 可使用以下属性:The following properties are available:

示例Example

使用**透视** 字段 (索引), 其中_索引_是字段名称或索引号, 返回单个透视字段对象。Use PivotFields (index), where index is the field name or index number, to return a single PivotField object.

下例使 Sheet3 上第一张数据透视表中的字段“Year”成为行字段。The following example makes the Year field 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.