Calculation Property

Applies To

Application Object, PivotField Object.

Description

For the Application object, returns or sets the calculation mode, as shown in the following table. Read-write.

Value

Meaning

xlAutomatic

Recalculate automatically.

xlManual

Recalculate only at user's request.

xlSemiautomatic

Recalculate automatically, except for data tables.


For the PivotField object, returns or sets the type of calculation done by the specified pivot field (one of xlDifferenceFrom, xlIndex, xlNormal, xlPercentDifferenceFrom, xlPercentOf, xlPercentOfColumn, xlPercentOfRow, xlPercentOfTotal, or xlRunningTotal). Valid only for data fields. Read-write.

See Also

CalculateBeforeSave Property.

Example

This example causes Microsoft Excel to calculate workbooks before they are saved to disk.


Application.Calculation = xlManual
Application.CalculateBeforeSave = True

This example sets the data field in the PivotTable on Sheet1 to calculate the difference from the base field, sets the base field to the field named "ORDER_DATE," and sets the base item to the item named "5/16/89."


Worksheets("Sheet1").Range("A3").PivotField.Calculation = _
    xlDifferenceFrom
Worksheets("Sheet1").Range("A3").PivotField.BaseField = "ORDER_DATE"
Worksheets("Sheet1").Range("A3").PivotField.BaseItem = "5/16/89"