Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
FCS FCS is offline
external usenet poster
 
Posts: 8
Default Avoiding a range in recalculation

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?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,624
Default Avoiding a range in recalculation

One way:

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

In article ,
FCS 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?

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 69
Default Avoiding a range in recalculation

On 20 Sep, 15:16, FCS 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:
ToolsOptionsCalculation

James

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Avoiding a range in recalculation

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,D2:D20")
.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,D2:D20")
.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

" wrote:

On 20 Sep, 15:16, FCS 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:
ToolsOptionsCalculation

James


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
Avoiding #N/A gibbylinks Excel Discussion (Misc queries) 8 February 6th 10 12:51 PM
Avoiding Recalculation for a function in automatic mode Lokesh Sharma Excel Worksheet Functions 1 September 19th 06 04:52 AM
AVOIDING DUPLICATES IN A RANGE OF CELLS Glint Excel Discussion (Misc queries) 11 August 9th 06 11:54 AM
Problem with Slow ReCalculation of Dynamic Range Using OFFSET Kris_Wright_77 Excel Worksheet Functions 2 November 18th 05 10:18 AM
write one column range to text avoiding final linebreak RB Smissaert Excel Programming 7 September 5th 04 02:18 AM


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