Excel 2007 exponential slowdown
Put your data into an array and store it a row at a time.
Storing data a cell at a time is a time killer.
The psuedo code for this is:
data = Array(5,7,8,12)
Range(myrow.Cells(1,1),Cells(1,4)).Value = data
It's also possible to insert the data for the entire Worksheet with a
similar single instruction.
In this instance, because there are only 200 rows, I recommend you
take my example, study it, and then figure out how to do this.
This will DRAMATICALLY improve performance.
Summary. Whenever possible store data a row at a time. If possible
store with a single instruction.
On Mar 15, 2:58 pm, "LoDawg" wrote:
I have a routine that imports worksheets from an older version of my
companies software to the latest version. Using it in office 2000/2003
a sheet with about 200 rows takes about 20-30 seconds. In office 2007
it was taking close to 6 minutes. I have already made several changes
and gotten the time down to just over a minute, but I would like to
know if anyone has an idea of what would cause this slowdown.
A little background info: The procedure starts off fine but as it
progresses it takes longer and longer to process each row. It
basically sets the value for a cell in the new workbook to the value
of the coresponding cell in the old workbook. Oh yeah and the last
thing you should know...Its legacy code in VB6
|