Turn off the AutoCalculation in one sheet only VBA

PaulaGon

New Member
Joined
Jan 31, 2017
Messages
16
Hello,


I have a large workbook with a lot of formulas and every time we change or insert data, by default, excel recalculates all the formulas and it takes a long time,. In my workbook I have Sheet1 that I use to insert daily information in Sheet2 I have almost all the formulas. I need to create a macro that disable the automatic calculation only in Sheet2. Is that possible? Calculation mode set to manual only in one sheet and create a comand button to calculate these sheet only when is need?

Thank in advanced!
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
Re: Turn off the AutiCalculation in one sheet only VBA

Code:
worksheets("sheet2").enablecalculation = false
 
Upvote 0
Re: Turn off the AutiCalculation in one sheet only VBA

I am sorry for this question...but i am a not very good with macros...

Where I put the code? In the developer at the level of the sheet?

Thank you
 
Upvote 0
Code:
Sub TurnOff()
  Worksheets("sheet2").EnableCalculation = False
End Sub

Sub TurnOn()
  Worksheets("sheet2").EnableCalculation = True
End Sub

1. Copy the code from the post
2. Press Alt+F11 to open the Visual Basic Editor (VBE)
3. From the menu bar in the VBE window, do Insert > Module
4. Paste the code in the window that opens
5. Press Alt+Q to close the VBE and return to Excel

Use Alt+F8 to run one macro or the other.

You'll need to save the workbook as an xlsm file.
 
Upvote 0
You're welcome.

It would probably be worthwhile to eliminate volatile formulas on Sheet2, then that probably wouldn't be necessary.
 
Upvote 0
Code:
Sub TurnOff()
  Worksheets("sheet2").EnableCalculation = False
End Sub

Sub TurnOn()
  Worksheets("sheet2").EnableCalculation = True
End Sub

1. Copy the code from the post
2. Press Alt+F11 to open the Visual Basic Editor (VBE)
3. From the menu bar in the VBE window, do Insert > Module
4. Paste the code in the window that opens
5. Press Alt+Q to close the VBE and return to Excel

Use Alt+F8 to run one macro or the other.

You'll need to save the workbook as an xlsm file.

I tried this and it did disable auto-calculate, however, when I typed in a vlookup formula and a sum formula (to test to auto-calculate) it returned only 0s.

Then I turned off the macro and magically the correct values appeared.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,947
Messages
6,122,411
Members
449,081
Latest member
JAMES KECULAH

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top