View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
keepITcool keepITcool is offline
external usenet poster
 
Posts: 2,253
Default Excel Automation - Chart Performance

Matt,

standard bottlenecks appear to be screenupdating and pagebreak
visibility.

BUT a lot depends on how you insert your data.. using variables is
generally a lot faster then just working with the selection and
activecell.

you can also fill an entire range from an array instead of cell by cell
(that's the real winner)

I didn't time for charts but i suspect the ScreenUpdating will be a
major factor.


timings to fill a range of 5000 cells

5000 5000 5000 5000 5000 4999
11,847 11,166 11,287 2,163 1,291 0,041


1: SELECT SU=TRUE, PB=TRUE
2: SELECT SU=TRUE, PB=FALSE
3: SELECT SU=FALSE, PB=TRUE
4: SELECT SU=FALSE, PB=FALSE
5: RNG SU=FALSE, PB=FALSE
6: ARRAY SU=FALSE, PB=FALSE

Code for 4, 5 and 6:

Application.ScreenUpdating = False
ActiveSheet.DisplayPageBreaks = False

m = 5000
t = Timer
[d1].Select
For r = 1 To m
ActiveCell = r
ActiveCell.Offset(1).Select
Next
Cells(r, 4) = Timer - t

t = Timer
For r = 1 To m
Cells(r, 5) = r
Next
Cells(r, 5) = Timer - t

t = Timer
ReDim arr(m) As Long
For r = 1 To m
arr(r) = r
Next
Cells(1, 6).Resize(r - 1) = WorksheetFunction.Transpose(arr)
Cells(r, 6) = Timer - t

if there's a lot of data or a lot of calculations
then it may be worth checking out the efficiency of your
worksheetfunctions.


suc6.

if u want, end me your xls & ppt and i can have a look.
address below.


keepITcool

< email : keepitcool chello nl (with @ and .)
< homepage: http://members.chello.nl/keepitcool


"Matt Tessar" wrote:

Hello,

I have a VB application that I have written that generates
charts and tables in Excel, and pastes them into
PowerPoint. I have found that the largest performance
bottleneck seems to be with the chart and with the table
rendering in excel.

Does anyone have any performance tips for automating excel?

Thanks
Matt