Skip to main content

Application.Calculation property

Table of contents
  1. Syntax
  2. Remarks
  3. Example

Returns or sets an XlCalculation value that represents the calculation mode.

Syntax

expression.Calculation

expression A variable that represents an Application object.

Remarks

For OLAP data sources, this property can only return or be set to xlNormal.

Example

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

Application.Calculation = xlCalculationManual 
Application.CalculateBeforeSave = True

The following example changes calculation mode to manual and enable iterative calculation.

Sub WorkbookCalculationManual()
    With Application
        'Workbook calculation settings
        .Calculation = xlCalculationManual  'Change calculation mode to manual
        '.CalculateBeforeSave = True 'Recalculate workbook before saving, if saving a workbook takes a long time, set to False.
        '.Calculation = xlCalculationAutomatic   'Change calculation mode to automatic
        '.Calculation = xlCalculationSemiautomatic   'Automatic except for data tables
        
        'Iterative calculation settings
        .Iteration = True   'Enable iterative calculation
        .MaxChange = 0.01   'Maximum Iterations
        .MaxIterations = 100    'Maximum Change
    End With
End Sub

Leave a comment

Your email address will not be published. Required fields are marked *

Format your code: <pre><code class="language-vba">place your code here</code></pre>