ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Auto Calculate selected worksheets (https://www.excelbanter.com/excel-programming/448051-auto-calculate-selected-worksheets.html)

garygoodguy

Auto Calculate selected worksheets
 
I have set my workbook to manual formula calculation via File -- Options -- Formula -- calculation options -- manual. The reason is that the workbook is very large with a number of calcs.

Now what I want to do is have only one worksheet to auto calculated, while the rest are still manual. How can I achieve this, and in what private sub/sub do I place the code?

I have tried worksheet("worksheet name").EnableCalculate = True
And placed it under Workbook_Open, but this doesn't work.

I'm looking for a way to have this one sheet always calculate (as opposed to active sheet, etc) as the sheet will be hidden.

Also, when I go into the sheet code of the sheet I want to be automatic, EnableCalculation in properties is set to True. How does this affect thing's?

Thanks in advance

GS[_2_]

Auto Calculate selected worksheets
 
garygoodguy laid this down on his screen :
I have set my workbook to manual formula calculation via File --
Options -- Formula -- calculation options -- manual. The reason is
that the workbook is very large with a number of calcs.

Now what I want to do is have only one worksheet to auto calculated,
while the rest are still manual. How can I achieve this, and in what
private sub/sub do I place the code?

I have tried worksheet("worksheet name").EnableCalculate = True
And placed it under Workbook_Open, but this doesn't work.

I'm looking for a way to have this one sheet always calculate (as
opposed to active sheet, etc) as the sheet will be hidden.

Also, when I go into the sheet code of the sheet I want to be automatic,
EnableCalculation in properties is set to True. How does this affect
thing's?

Thanks in advance


When calc is in manual mode you must execute the Calculate method to
cause calculation. This will happen for every sheet where
EnableCalculation is turned on (=True)...

Application.Calculate
OR
Sheets(1).Calculate
OR
Sheets(1).Rows(2).Calculate
OR
Sheets(1).Columns(2).Calculate
OR
Sheets("Sheet1").UsedRange.Columns("A:C").Calculat e


HTH

--
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion



garygoodguy

Thanks Garry.

If I understand you correctly, I can still have the options calc set to manual; but would have to put code into any sheet that I want to calculate automatically?

So if I were to utilise:
Sheets("Sheet1").UsedRange.Columns("A:C").Calculat e

Where would I place this code? I'm assuming in the sheet, i.e Sheet1? Under what private sub?
Or would I place this under Workbook_open in 'ThisWorkbook'?

Thanks in advance.



Quote:

Originally Posted by GS[_2_] (Post 1608859)
garygoodguy laid this down on his screen :
I have set my workbook to manual formula calculation via File --
Options -- Formula -- calculation options -- manual. The reason is
that the workbook is very large with a number of calcs.

Now what I want to do is have only one worksheet to auto calculated,
while the rest are still manual. How can I achieve this, and in what
private sub/sub do I place the code?

I have tried worksheet("worksheet name").EnableCalculate = True
And placed it under Workbook_Open, but this doesn't work.

I'm looking for a way to have this one sheet always calculate (as
opposed to active sheet, etc) as the sheet will be hidden.

Also, when I go into the sheet code of the sheet I want to be automatic,
EnableCalculation in properties is set to True. How does this affect
thing's?

Thanks in advance


When calc is in manual mode you must execute the Calculate method to
cause calculation. This will happen for every sheet where
EnableCalculation is turned on (=True)...

Application.Calculate
OR
Sheets(1).Calculate
OR
Sheets(1).Rows(2).Calculate
OR
Sheets(1).Columns(2).Calculate
OR
Sheets("Sheet1").UsedRange.Columns("A:C").Calculat e


HTH

--
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion


garygoodguy

Disregard the last post.
I have placed:

Sheets("Sheet1").UsedRange.Columns("A:C").Calculat e

in Private Sub Worksheet_Activate()

And it works perfectly.
Thanks a bunch.

Quote:

Originally Posted by garygoodguy (Post 1608860)
Thanks Garry.

If I understand you correctly, I can still have the options calc set to manual; but would have to put code into any sheet that I want to calculate automatically?

So if I were to utilise:
Sheets("Sheet1").UsedRange.Columns("A:C").Calculat e

Where would I place this code? I'm assuming in the sheet, i.e Sheet1? Under what private sub?
Or would I place this under Workbook_open in 'ThisWorkbook'?

Thanks in advance.


GS[_2_]

Auto Calculate selected worksheets
 
garygoodguy explained :
Where would I place this code? I'm assuming in the sheet, i.e Sheet1?
Under what private sub?
Or would I place this under Workbook_open in 'ThisWorkbook'?


It depends when you want it to calculate! If when the file opens then
in the Workbook_Open event. If before the file closes then in the
Workbook_BeforeClose event. If when you click a button or custom
menuitem then in a standard module sub named appropriate to its use.

Sub CalculateSheet()
Sheets("Sheet1").UsedRange.Columns("A:C").Calculat e
End Sub

--
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion



GS[_2_]

Auto Calculate selected worksheets
 
Glad you got it working. Always happy to help wherever I can...

--
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion




All times are GMT +1. The time now is 08:38 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com