Turning off a formula in cells or a sheet

rossrc

New Member
Joined
Jan 28, 2005
Messages
10
Can you turn off calculations in a Cell or an entire sheet using code?

I have a spreadsheet that calculates metrics for workers, and I want to use this same workbook to calculate metrics for managers.

The managers portion, however, uses Vlookups which really slow down the system. I'm looking for a way to turn off the manager calculations when checking on the workers metrics and turn them back on when we need to view the managers metrics. The managers calculations are all done on one specific sheet.
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
Kind of

TJH said:
Hi

Perhaps you mean:

tools --> options --> calculation --> manual.

Well that's not exactly code, but I guess I'll try recording as a macro to see what the commands are. Thanks.
 
Upvote 0
Nope that didn't work. That works for the whole workbook and the users will have to keep clicking the f9 key when viewing the rest of the workbook.

What I'm really looking for is when a SHEET is unhidden then the calculations on the sheet start working. When the SHEET is hidden then the calculations turn off. Anyone know of code to do that?
 
Upvote 0
You can insert this in the Sheet necessary (change the number to apply), and some other code may be necessary depending on how you hide the sheets, and if this is user driven or not.
Sub CalcCheck()

If Sheets("Sheet1").Visible = False Then _
Sheets("Sheets1")..EnableCalculations = False

Else Sheets("Sheets1").EnableCalculations = True

End If

End Sub
 
Upvote 0
Put the following code into the Project Module called "ThisWorkBook". :wink:

Then only the active sheet will have caculations being done automatically whenever there is a direct change in it.

Private Sub Workbook_Open()
Application.Calculation = xlManual
End Sub

Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
ActiveSheet.Calculate
End Sub

Private Sub Workbook_BeforeClose(Cancel As Boolean)
Application.Calculation = xlAutomatic
End Sub

EXPLAINATION
The OPen event turn caculations to Manual....
The Change of a value in a sheet triggers that specific sheet to be calc'd
The close event turns auto calcs back on for the appliation.
 
Upvote 0

Forum statistics

Threads
1,214,948
Messages
6,122,420
Members
449,083
Latest member
Ava19

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