CalculatedFields 方法 (Excel)CalculatedFields.Item method (Excel)

从集合中返回一个对象。Returns a single object from a collection.

语法Syntax

表达式(索引)expression.Item (Index)

_表达式_一个代表**CalculatedFields** 对象的变量。expression A variable that represents a CalculatedFields object.

参数Parameters

名称Name 必需/可选Required/Optional 数据类型Data type 说明Description
IndexIndex 必需Required VariantVariant 对象的名称或索引号。The name or index number for the object.

返回值Return value

包含在集合中的一个**透视字段** 对象。A PivotField object contained by the collection.

说明Remarks

对象的文本名称是**name** 和**value** 属性的值。The text name of the object is the value of the Name and Value properties.

示例Example

此示例为第一个计算字段设置公式。This example sets the formula for calculated field one.

Worksheets(1).PivotTables(1).CalculatedFields.Item(1) _ 
 .Formula = "=Revenue - Cost"

支持和反馈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.