VBA – Turn Automatic Calculations Off (or On)

Associated Files Download Links


Whenever you update a cell, Excel goes through a process to recalculate the workbook. When working directly within Excel you want this to happen 99.9% of the time (the exception being if you are working with an extremely large workbook). However, this can really slow down your VBA code. It’s a good practice to set your calculations to manual at the begining of macros and restore calculations at the end of macros. If you need to recalculate the workbook you can manually tell Excel to calculate.

Turn Off Automatic Calculations

You can turn off automatic calculation with a macro by setting it to xlmanual. Use the following piece of VBA code:

Turn Automatic Calculations Back On

To turn on automatic calculation from VBA:

Manual Calculation

To force Excel to recalculate use this command:

You can also tell Excel to recalculate an individual worksheet:

You can also tell VBA to recalculate just a range (click to read our article about VBA calculation methods)

VBA Coding Made Easy

Stop searching for VBA code online. Learn more about AutoMacro – A VBA Code Builder that allows beginners to code procedures from scratch with minimal coding knowledge and with many time-saving features for all users!

alt text

 

Learn More!


<<Return to VBA Examples

Did you find this VBA tutorial useful? Then share it with your friends and colleagues:

You may also like some of this related content...

As cool as it looks watching your macro manipulate the screen, you can help it
Custom Status Bar Message You can update the status bar with your own custom message
You can toggle scrollbars On or Off using a macro: Turn On Scrollbars Sub TurnOnScroll()
If your template design requires making Excel look less like Excel, you might want to
You can change the default username with vba. This is the default name that shows
Advertisements
Automate Excel
Left Menu Icon