Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming,microsoft.public.excel.misc
external usenet poster
 
Posts: 2
Default Excel 2000 formula recalc problem

Hi everybody,

I have a problem making sure all the formulas in the spreadsheet
recalculate, when recalc is called from within a macro.

I have a complicated spreadsheet model that takes a second or two to
recalculate. I run a macro that:

1. Sets up parameters
2. Forces recalc
3. Grabs the output
4. Cycles back to step 1 with different parameters, etc.

My code looks something like this:

For j = pageFirst To pageLast Step pageStep

<set up parameters of the j-th scenario
Application.CalculateFull
<save the output, which is just a rectangular range in one of
the tabs

Next

The problem is, sometimes Excel seems to grab the output before a
complete recalc is done. So the formulas are only partially updated
when the output is saved.

This happens pretty randomly, but also frequently enough (once in a
1,000 loops or so).

Why is this happening?
Is there any way to make ABSOLUTELY sure ALL formulas have been
recalc'd before proceeding to the output?

Thanks a lot!
Tom
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 45
Default Excel 2000 formula recalc problem

Tom, could it be that you need to turn off the re-cal
(Application.Calculation = xlCalculationManual) until you
are ready and then turn it back on
(Application.Calculation = xlCalculationAutomatic) just
before you re-calculate?

-----Original Message-----
Hi everybody,

I have a problem making sure all the formulas in the

spreadsheet
recalculate, when recalc is called from within a macro.

I have a complicated spreadsheet model that takes a

second or two to
recalculate. I run a macro that:

1. Sets up parameters
2. Forces recalc
3. Grabs the output
4. Cycles back to step 1 with different parameters, etc.

My code looks something like this:

For j = pageFirst To pageLast Step pageStep

<set up parameters of the j-th scenario
Application.CalculateFull
<save the output, which is just a rectangular

range in one of
the tabs

Next

The problem is, sometimes Excel seems to grab the output

before a
complete recalc is done. So the formulas are only

partially updated
when the output is saved.

This happens pretty randomly, but also frequently enough

(once in a
1,000 loops or so).

Why is this happening?
Is there any way to make ABSOLUTELY sure ALL formulas

have been
recalc'd before proceeding to the output?

Thanks a lot!
Tom
.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Excel 2000 formula recalc problem

Ken,

You're right: I do switch Excel to manual calc at the start of the
macro. But then calling

Application.Calculation = xlCalculationAutomatic

would be identical to

Application.CalculateFull

Actually, from what I understand the latter is supposed to be a more
powerful way to force recalc than the former.

Again, it's not that my code doesn't work. It does work OK, but with
an occasional hiccup, which to me means the problem is probably not in
my code, but in the way Excel handles recalc.

Thanks for your reply, though
Tom


"Ken" wrote in message ...
Tom, could it be that you need to turn off the re-cal
(Application.Calculation = xlCalculationManual) until you
are ready and then turn it back on
(Application.Calculation = xlCalculationAutomatic) just
before you re-calculate?

-----Original Message-----
Hi everybody,

I have a problem making sure all the formulas in the

spreadsheet
recalculate, when recalc is called from within a macro.

I have a complicated spreadsheet model that takes a

second or two to
recalculate. I run a macro that:

1. Sets up parameters
2. Forces recalc
3. Grabs the output
4. Cycles back to step 1 with different parameters, etc.

My code looks something like this:

For j = pageFirst To pageLast Step pageStep

<set up parameters of the j-th scenario
Application.CalculateFull
<save the output, which is just a rectangular

range in one of
the tabs

Next

The problem is, sometimes Excel seems to grab the output

before a
complete recalc is done. So the formulas are only

partially updated
when the output is saved.

This happens pretty randomly, but also frequently enough

(once in a
1,000 loops or so).

Why is this happening?
Is there any way to make ABSOLUTELY sure ALL formulas

have been
recalc'd before proceeding to the output?

Thanks a lot!
Tom
.

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
Excel 2000 Problem A. J. Castelli Excel Discussion (Misc queries) 0 October 3rd 09 03:09 AM
PROBLEM:How to squeeze 2 Page sized Chart in Excel 2000 & embed in Word 2000 and print from Word to fit one page ??? [email protected] Excel Discussion (Misc queries) 2 September 10th 08 11:07 AM
PROBLEM:How to squeeze 2 Page sized Chart in Excel 2000 & embed in Word 2000 and print from Word to fit one page ??? [email protected] New Users to Excel 2 September 10th 08 11:07 AM
problem excel 2000 hans[_3_] Excel Programming 1 April 28th 04 03:01 AM
UDF recalc problem between sheets Sandy V[_6_] Excel Programming 7 April 9th 04 04:06 PM


All times are GMT +1. The time now is 06:31 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"