Automatic Calculation

APML

Board Regular
Joined
Sep 10, 2021
Messages
216
Office Version
  1. 365
Hi All, I have a workbook with lots of worksheets that perform many calculations. To make the workbook perform better I've set up the below macro which turns on and off automatic calculations for some of the sheets.
I'm just wondering if anyone can suggest a way, so I can know with a quick glance if automatic or manual calculation is set for the specifc workheet..
I was thinking something like a cell might change colour or something... was looking for a way that doesn't require me to do a calculation to find out if the sheet is set to automatic or manual


Sub TurnOff()

Worksheets("ASX_Data").EnableCalculation = False

Worksheets("Analysis").EnableCalculation = False

Worksheets("TodaysData").EnableCalculation = False

MsgBox ("AutoCalc Is OFF")

End Sub

Sub TurnOn()

Worksheets("ASX_Data").EnableCalculation = True

Worksheets("Analysis").EnableCalculation = True

Worksheets("TodaysData").EnableCalculation = True
MsgBox ("AutoCalc Is ON")
End Sub
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
Maybe the colour of the worksheet tab?
VBA Code:
Worksheets("ASX_Data").EnableCalculation = False
Worksheets("ASX_Data").Tab.Color = RGB(255, 0, 0)    'Red=Disabled

VBA Code:
Worksheets("ASX_Data").EnableCalculation = True
Worksheets("ASX_Data").Tab.Color = RGB(0, 255, 0)   'Green=enabled


If you already use colors and prefer not modifying them, then you might use TintAndShade:
VBA Code:
Worksheets("ASX_Data").EnableCalculation = False
Worksheets("ASX_Data").Tab.TintAndShade = -1    '-1 set the tab to black

VBA Code:
Worksheets("ASX_Data").EnableCalculation = True
Worksheets("ASX_Data").Tab.TintAndShade = 0     '0 restores the original colour
 
Upvote 0
Hey thats sounds fantastic..I'm really happy to have the tabs colour change. I'm not very good at vba.. Do I just insert the line into my code, or is it a separate module..And do I need to do it for each worksheet, at the moment I'm switching 3 worksheets on and off automatic calculation at the same time
 
Upvote 0
Just add the line that manages the tab colour to your code; ie
VBA Code:
Sub TurnOff()

Worksheets("ASX_Data").EnableCalculation = False
Worksheets("ASX_Data").Tab.Color = RGB(255, 0, 0)

Worksheets("Analysis").EnableCalculation = False
Worksheets("Analysis").Tab.Color = RGB(255, 0, 0)

Worksheets("TodaysData").EnableCalculation = False
Worksheets("TodayData").Tab.Color = RGB(255, 0, 0)

MsgBox ("AutoCalc Is OFF")

End Sub
You don't need to modify the colours for the other tabs, other then for cosmetics choices
 
Upvote 0
So I added the did the follow but got an error:

Sub TurnOff()
Worksheets("ASX_Data").EnableCalculation = False
Worksheets("ASX_Data").Tab.Color = RGB(255, 0, 0)
Worksheets("Analysis").EnableCalculation = False
Worksheets("TodaysData").EnableCalculation = False
Worksheets("ASX_Companies").EnableCalculation = False

MsgBox ("AutoCalc Is OFF")
End Sub

Sub TurnOn()
Worksheets("ASX_Data").EnableCalculation = True
Worksheets("Analysis").EnableCalculation = True
Worksheets("TodaysData").EnableCalculation = True
Worksheets("ASX_Companies").EnableCalculation = True

MsgBox ("AutoCalc Is ON")



End Sub
 
Upvote 0
Which line? Wich error?

Is it clear that you set Red only the ASX_Data tab, whereas you disable calculation on 4 sheets?
And, since you don't rework the color when re-enable claculation, the tab will stay red forever
 
Upvote 0
So I've modified the code and taken a screen shot of the problem, btw i really appreciate the help.
1652093242402.png
 
Upvote 0
Do you get an error message?
Is the code inserted in a Standard Vba Module of the workbook that contains those sheets?
Are you on a Window environment?
 
Upvote 0
Yes, pls see error screen shot. And yes so far as i know it's a standard vba module (i'm not so good at vba so not entirely sure).
Yes use windows 10
1652094880209.png
 
Upvote 0
Is the worksheet ASX_Data Visible or Hidden? Is the worksheet or the workbook protected?
If you grab the yellow arrow (near the yellow vba line) and move it on the next line (so skipping color setting the ASX_Data tab) and press F5 (to continue the macro) what happens?
What happens if you run Sub TurnOn?
 
Upvote 0

Forum statistics

Threads
1,223,236
Messages
6,170,915
Members
452,366
Latest member
TePunaBloke

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