PC Review


Reply
Thread Tools Rate Thread

Avoiding a range in recalculation

 
 
=?Utf-8?B?RkNT?=
Guest
Posts: n/a
 
      20th Sep 2007
I have a fairly large Excel spreadsheet with a small VBA program that
conducts a simulation using the spreadsheets as a calculation engine. A
number of results are obtained from each simulation run which are stored in a
table. The sheet includes a result summary area which summarises data
extracted from the results in accordance with certain criteria using
sumproduct functions. The table is large >40 thousand rows and I don't want
the summary to be calculated every time that a result is added to the table
as it results in an unacceptable reduction in speed (from seconds to hours!).
How could I restrict the recalculation so that the summary is never
calculated until the simulation is completed?
 
Reply With Quote
 
 
 
 
JE McGimpsey
Guest
Posts: n/a
 
      20th Sep 2007
One way:

Clear the summary cells when your macro starts, and reinsert the summary
formulae at the end of the macro.

In article <97FBF584-576E-4F2A-9221-(E-Mail Removed)>,
FCS <(E-Mail Removed)> wrote:

> I have a fairly large Excel spreadsheet with a small VBA program that
> conducts a simulation using the spreadsheets as a calculation engine. A
> number of results are obtained from each simulation run which are stored in a
> table. The sheet includes a result summary area which summarises data
> extracted from the results in accordance with certain criteria using
> sumproduct functions. The table is large >40 thousand rows and I don't want
> the summary to be calculated every time that a result is added to the table
> as it results in an unacceptable reduction in speed (from seconds to hours!).
> How could I restrict the recalculation so that the summary is never
> calculated until the simulation is completed?

 
Reply With Quote
 
james.billy@gmail.com
Guest
Posts: n/a
 
      20th Sep 2007
On 20 Sep, 15:16, FCS <F...@discussions.microsoft.com> wrote:
> I have a fairly large Excel spreadsheet with a small VBA program that
> conducts a simulation using the spreadsheets as a calculation engine. A
> number of results are obtained from each simulation run which are stored in a
> table. The sheet includes a result summary area which summarises data
> extracted from the results in accordance with certain criteria using
> sumproduct functions. The table is large >40 thousand rows and I don't want
> the summary to be calculated every time that a result is added to the table
> as it results in an unacceptable reduction in speed (from seconds to hours!).
> How could I restrict the recalculation so that the summary is never
> calculated until the simulation is completed?


Could you not switch off calculation?

In Code:

Application.Calculation = xlManual

Then at the end of the simulation:

Application.Calculation = xlAutomatic

Or a manual approach:
Tools>Options>Calculation

James

 
Reply With Quote
 
=?Utf-8?B?VG9tIE9naWx2eQ==?=
Guest
Posts: n/a
 
      20th Sep 2007
Can we assume that part of the simulation is the calculation of formulas in
Excel and turning off calculation would not be acceptable.

then

Sub Simulation()

With Worksheets.Summary("Range("B2:B20,D220")
.Replace What:="=", _
Replacement:="ZZ=", _
LookAt:=xlPart, _
SearchOrder:=xlByRows, _
MatchCase:=False
End With

' code that does the simulation and writes the table

With Worksheets.Summary("Range("B2:B20,D220")
.Replace What:="ZZ=", _
Replacement:="=", _
LookAt:=xlPart, _
SearchOrder:=xlByRows, _
MatchCase:=False
End With

End Sub

This converts your formulas to text strings so they don't calculate, then
changes them back to formulas. Modify the range to match the cells you want
suppressed.

--
Regards,
Tom Ogilvy

"(E-Mail Removed)" wrote:

> On 20 Sep, 15:16, FCS <F...@discussions.microsoft.com> wrote:
> > I have a fairly large Excel spreadsheet with a small VBA program that
> > conducts a simulation using the spreadsheets as a calculation engine. A
> > number of results are obtained from each simulation run which are stored in a
> > table. The sheet includes a result summary area which summarises data
> > extracted from the results in accordance with certain criteria using
> > sumproduct functions. The table is large >40 thousand rows and I don't want
> > the summary to be calculated every time that a result is added to the table
> > as it results in an unacceptable reduction in speed (from seconds to hours!).
> > How could I restrict the recalculation so that the summary is never
> > calculated until the simulation is completed?

>
> Could you not switch off calculation?
>
> In Code:
>
> Application.Calculation = xlManual
>
> Then at the end of the simulation:
>
> Application.Calculation = xlAutomatic
>
> Or a manual approach:
> Tools>Options>Calculation
>
> James
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Avoiding Recalculation for a function in automatic mode =?Utf-8?B?TG9rZXNoIFNoYXJtYQ==?= Microsoft Excel Worksheet Functions 2 19th Sep 2006 04:52 AM
Avoiding Recalculation for a function in automatic mode =?Utf-8?B?TG9rZXNoIFNoYXJtYQ==?= Microsoft Excel Worksheet Functions 0 18th Sep 2006 01:16 PM
AVOIDING DUPLICATES IN A RANGE OF CELLS =?Utf-8?B?R2xpbnQ=?= Microsoft Excel Misc 11 9th Aug 2006 11:54 AM
Problem with Slow ReCalculation of Dynamic Range Using OFFSET =?Utf-8?B?S3Jpc19XcmlnaHRfNzc=?= Microsoft Excel Worksheet Functions 2 18th Nov 2005 10:18 AM
write one column range to text avoiding final linebreak RB Smissaert Microsoft Excel Programming 7 5th Sep 2004 02:18 AM


Features
 

Advertising
 

Newsgroups
 


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