PivotItem.Formula 属性 (Excel)PivotItem.Formula property (Excel)

返回或设置一个String值,它代表 A1 样式表示法和宏语言中的对象的公式。Returns or sets a String value that represents the object's formula in A1-style notation and in the language of the macro.


表达式expression. Formula

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


此属性对 OLAP 数据源无效。This property is not available for OLAP data sources.

如果单元格包含常量,则此属性返回该常量。If the cell contains a constant, this property returns the constant. 如果单元格为空,则此属性返回一个空字符串。If the cell is empty, this property returns an empty string. 如果单元格包含公式,则公式属性将返回相同的格式将公式栏 (包括等号) 中显示的字符串形式的公式。If the cell contains a formula, the Formula property returns the formula as a string in the same format that would be displayed in the formula bar (including the equal sign).

如果将单元格的值或公式设为日期类型,Microsoft Excel 将检查该单元格的格式是否符合某个日期或时间数组格式。If you set the value or formula of a cell to a date, Microsoft Excel checks to see whether that cell is already formatted with one of the date or time number formats. 如果未设置,Microsoft Excel 会将数字格式更改为默认的短日期数字格式。If not, Microsoft Excel changes the number format to the default short date number format.

如果区域是一维或二维区域,则可将公式指定为 Visual Basic 中相同维数的数组。If the range is a one- or two-dimensional range, you can set the formula to a Visual Basic array of the same dimensions. 同样,也可在 Visual Basic 数组中使用公式。Similarly, you can put the formula into a Visual Basic array.

如果为多单元格区域设置公式,则用该公式填充该区域中的所有单元格。Setting the formula for a multiple-cell range fills all cells in the range with the formula.

另请参阅See also

PivotItem 对象PivotItem Object

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