CalculationState Property

Microsoft Excel Visual Basic

Show All

CalculationState Property

       

Returns an XlCalculationState constant that indicates the calculation state of the application, for any calculations that are being performed in Microsoft Excel. Read-only.

XlCalculationState can be one of these XlCalculationState constants.
xlCalculating
xlDone
xlPending

expression.CalculationState

expression   Required. An expression that returns one of the objects in the Applies To list.

Example

In this example, Microsoft Excel checks to see if any calculations are being performed. If no calculations are being performed, a message  displays the calculation state as "Done". Otherwise, a message displays the calculation state as "Not Done".

Sub StillCalculating()

    If Application.CalculationState = xlDone Then
        MsgBox "Done"
    Else
        MsgBox "Not Done"
    End If

End Sub