Turning off automatic calculations in Excel using VBA temporarily suspends formula recalculation, which significantly speeds up macro execution—especially in large or complex workbooks where formulas recalculate after every cell change. This is useful when you're performing bulk edits, data imports, or iterative operations that would otherwise trigger repeated, unnecessary recalculations. No special add-ins or permissions are required beyond standard Excel VBA access.
What You'll Need
- Excel installed (Microsoft 365, Excel 2021, 2019, 2016, or 2013)
- A workbook with formulas you want to control
- Developer tab enabled (required to access the VBA editor)
- Basic familiarity with writing or running VBA macros
Step-by-Step
- Open your Excel workbook that contains formulas you want to suppress during macro execution.
- Press Alt + F11 to open the Visual Basic for Applications (VBA) editor. If the Developer tab isn't visible in Excel, go to File > Options > Customize Ribbon, check the Developer box, and click OK.
- In the VBA editor, locate the Project Explorer window (press Ctrl+R if it's not visible). Find your workbook under VBAProject (YourWorkbookName.xlsx).
- Double-click the module where you want to add or edit code (e.g., Module1), or right-click the workbook name > Insert > Module to create a new one.
- Type or paste the following VBA code at the top of your macro procedure:
Application.Calculation = xlCalculationManualThis line disables automatic calculation before your main operations begin. - Insert your existing data manipulation code (e.g., loops that write values, copy ranges, or import data) *after* the manual calculation line.
- Before your macro ends, restore automatic calculation by adding this line just before
End Sub:Application.Calculation = xlCalculationAutomaticThis ensures Excel resumes normal behavior for any subsequent user actions. - Save the workbook as a macro-enabled file (.xlsm) by going to File > Save As > Browse > Excel Macro-Enabled Workbook (*.xlsm).
- Return to Excel and run your macro using Alt+F8, selecting it from the list, and clicking Run. Verify that calculations are suppressed during execution and resume afterward.
Common Mistakes
- Forgetting to restore
xlCalculationAutomatic, leaving Excel stuck in manual mode—users then see outdated formula results without realizing why. - Placing the restoration line *inside* an error-handling block without proper cleanup, causing it to skip if an error occurs.
- Using
CalculateorCalculateFullmethods instead of togglingCalculation, which doesn’t prevent recalculation during cell edits. - Assuming all sheets recalculate together—manual mode applies workbook-wide, but individual sheets may still be affected if dependencies span multiple workbooks.
Tips
- Wrap your macro in an error-handling routine (e.g.,
On Error GoTo Cleanup) and place the calculation reset in the cleanup section to guarantee restoration even if an error occurs. - Use
Application.Calculation = xlCalculationSemiautomaticonly if you want formulas to recalculate when *inputs* change but not during rapid updates—this is rarely needed and often less efficient than full manual mode for bulk edits. - For targeted control, combine
Application.Calculation = xlCalculationManualwithSheet1.Calculateto force recalculation on a specific sheet only when needed. - Disable screen updating (
Application.ScreenUpdating = False) and events (Application.EnableEvents = False) alongside calculation control for maximum performance gains.
Troubleshooting
- Formulas still updating during macro execution: Double-check that
Application.Calculation = xlCalculationManualis placed *before* any code that modifies cells. If it’s inside a loop or conditional block, it may not execute early enough. - Excel stays in manual mode after running the macro: Open the Formulas tab and verify the Calculation Options button doesn’t show Manual. If it does, manually switch it back to Automatic, or run a simple macro with only
Application.Calculation = xlCalculationAutomaticto reset it. - “Macro not found” or VBA errors: Ensure the workbook is saved as .xlsm (not .xlsx) and that macro security settings allow macros to run (File > Options > Trust Center > Trust Center Settings > Macro Settings > Enable all macros temporarily for testing).
- Calculation doesn’t resume automatically: Add
On Error GoTo 0before resetting calculation to disable error handling, or test with a minimal macro containing only the two calculation lines to isolate the issue. - External links or add-ins interfere: Go to Data > Queries & Connections > Connections, and check if any external data connections are set to refresh automatically. Temporarily disable them during macro execution by setting
Connection.RefreshStyle = xlOverwriteCellsandConnection.Refreshmanually instead.
Frequently Asked Questions
Does turning off calculations affect saved data?
No—disabling calculation only pauses *when* formulas re-evaluate. Your data and formulas remain unchanged. Once automatic mode resumes, Excel recalculates based on the latest values.Can I disable calculation for just one worksheet?
No.Application.Calculation is workbook-wide. To simulate sheet-level control, set Application.Calculation = xlCalculationManual and use Sheets("Sheet1").Calculate only when you want to force recalculation on that specific sheet.
Why does my macro still slow down after setting xlCalculationManual?
Other factors may dominate performance: screen updating, event triggers, or inefficient loops. CombineApplication.ScreenUpdating = False and Application.EnableEvents = False with proper cleanup at the end.
Does this work in Excel Online or mobile?
No. VBA is only supported in desktop versions of Excel for Windows and macOS. Excel Online and mobile apps do not support macro execution or VBA.What if I accidentally run a macro without restoring calculation?
Press Ctrl+Alt+Shift+F9 to force a full recalculation of all open workbooks, which will also revert to automatic behavior. Alternatively, manually change Calculation Options back to Automatic via the Formulas tab.How do I know if calculation is currently manual or automatic?
Open the Formulas tab and check the Calculation Options button: it displays Automatic or Manual. In VBA, useMsgBox Application.Calculation—-4105 means manual, -4105 is xlCalculationManual and 1 is xlCalculationAutomatic.