View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Jim Cone Jim Cone is offline
external usenet poster
 
Posts: 3,290
Default Excel Slowing To A Crawl

Paul,

OK then, are you deleting from the bottom up?...
Something like...

For MyRow = LastRow to FirstRow Step -1
If .... Then Rows(MyRow).Delete
Next 'MyRow

Regards,
Jim Cone
San Francisco, CA
***************
"Paul W Smith" wrote in message
...
Jim,
Thanks for your suggestion, I put your line of code either side of my line
deletion statement, but on this occasion it does not seem to be making any

discernable difference to my problem.
Any others ideas anyone?
Paul Smith


"Jim Cone" wrote in message
...
Paul,
When accessing PageSetUp or deleting columns / rows use...
"YourSheet".DisplayPageBreaks = False
immediately after the operation.
You can get an amazing speed increase, as Excel does not have to figure

out where to put the pagebreaks. I have had best results using it before
AND after.
Regards,
Jim Cone
San Francisco,CA
***************
"Paul W Smith" wrote in message
...
I have a sub routine that runs though a series of workbooks, and

through
each worksheet within each workbook. The routine performs it's purpose

and
determines whether a row needs to be deleted.
If a condition is met then the flowing line of code performs the

deletion:
[ForecastStart].Offset(r - 1, 0).EntireRow.Delete xlShiftUp
When the code runs the various workbooks are opening, the worksheets

looped
through and saved and closed again.
PROBLEM
The code starts of running very quickly but slowly slows to a crawl.

The line of code above is the one which causes the problem. When I step
through
the code it is this line that takes longer and longer to execute as the
length of time the program has been running lengthens.
The order I loop through the workbooks makes no difference.
If I loop in a different order the workbooks, with the apparently

slow workbooks at the front then they whizz through and the fast ones now
crawl. Both screenupdating has been set to false and calculation set to
manual to try to alleviate the problem.
Please please someone give me some things to try!