Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Detecting Calculation State

firstly, thanks for the invisible range names advice -
thats solved.
is it possible to detect the calculation state of a
workbook such that the macro will only make it recalculate
if it requires it. I run Excel 2000. Thanks
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 550
Default Detecting Calculation State

Chris,

The following code is from Myrna Larson:

Application.ScreenUpdating = False
SaveCalcMode = Application.Calculation
Application.Calculation = xlCalculationManual
' your code here
Application.Calculation = SaveCalcMode
Application.ScreenUpdating = True

When you get to the "your code here" line, calculation will
be set to manual, regardless of what it was before.
Within your code, you can calculate the entire workbook
Application.Calculation = xlCalculationAutomatic
or a specific sheet
Worksheets("Sheet1").Calculate
With the coding above, Excel will return to whatever calculation
state it was in before you ran the code.

John

Chris Gorham wrote:

firstly, thanks for the invisible range names advice -
thats solved.
is it possible to detect the calculation state of a
workbook such that the macro will only make it recalculate
if it requires it. I run Excel 2000. Thanks


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Detecting Calculation State

Sorry,

nice try - but sometimes I have a very large model and I
only want to recalculate it if it needs to be - I need to
detect the calculation status (assuming that the model is
already set to manual recalc)

Chris

-----Original Message-----
Chris,

The following code is from Myrna Larson:

Application.ScreenUpdating = False
SaveCalcMode = Application.Calculation
Application.Calculation = xlCalculationManual
' your code here
Application.Calculation = SaveCalcMode
Application.ScreenUpdating = True

When you get to the "your code here" line, calculation

will
be set to manual, regardless of what it was before.
Within your code, you can calculate the entire workbook
Application.Calculation = xlCalculationAutomatic
or a specific sheet
Worksheets("Sheet1").Calculate
With the coding above, Excel will return to whatever

calculation
state it was in before you ran the code.

John

Chris Gorham wrote:

firstly, thanks for the invisible range names advice -
thats solved.
is it possible to detect the calculation state of a
workbook such that the macro will only make it

recalculate
if it requires it. I run Excel 2000. Thanks


.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 968
Default Detecting Calculation State

Hi Chris,

In Excel 2002 you can check:
if application.calculationstate=xlpending then
application.calculate
endif

before xl2002 there is no good method: you can check if the workbook has
been changed by checking the Workbook.Saved property, but that is a bit
oversensitive.


hth
Charles
______________________
Decision Models
The Excel Calculation Site
www.DecisionModels.com

"Chris Gorham" wrote in message
...
Sorry,

nice try - but sometimes I have a very large model and I
only want to recalculate it if it needs to be - I need to
detect the calculation status (assuming that the model is
already set to manual recalc)

Chris

-----Original Message-----
Chris,

The following code is from Myrna Larson:

Application.ScreenUpdating = False
SaveCalcMode = Application.Calculation
Application.Calculation = xlCalculationManual
' your code here
Application.Calculation = SaveCalcMode
Application.ScreenUpdating = True

When you get to the "your code here" line, calculation

will
be set to manual, regardless of what it was before.
Within your code, you can calculate the entire workbook
Application.Calculation = xlCalculationAutomatic
or a specific sheet
Worksheets("Sheet1").Calculate
With the coding above, Excel will return to whatever

calculation
state it was in before you ran the code.

John

Chris Gorham wrote:

firstly, thanks for the invisible range names advice -
thats solved.
is it possible to detect the calculation state of a
workbook such that the macro will only make it

recalculate
if it requires it. I run Excel 2000. Thanks


.



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
replace state names with state code abbreviations se7098 Excel Worksheet Functions 3 July 25th 09 06:41 PM
Detecting Calc On or Off dhstein Excel Discussion (Misc queries) 5 April 22nd 09 10:41 AM
How can I show state-by-state data (as silos) on a map of NA Rob Charts and Charting in Excel 0 November 5th 07 03:41 PM
Converting State Names to State Abbreviations aznate Excel Discussion (Misc queries) 1 October 20th 06 06:52 AM
Detecting absentees gracegift Excel Discussion (Misc queries) 7 December 27th 04 11:35 PM


All times are GMT +1. The time now is 09:39 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"