ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   speeding up copy and paste code (https://www.excelbanter.com/excel-programming/359433-speeding-up-copy-paste-code.html)

cereldine[_18_]

speeding up copy and paste code
 

Im developing some code that will look for values in about 1
spreadsheets that are provided for us externally (sheet A).
I need to extract about 115 columns of data out of about 123 b
determining the criteria, i can do this fine, i can also declare th
range i want to copy fine and if this code is run on its own it wil
loop through to the end in seconds.

The code starts to slow down when i start adding the code to paste th
data into the required spreadsheet (sheet B), this has to be done on
coloumn at a time so as to ommit columns i don't need. the copy cod
and paste code work really fast, the code slows down when iv
performed one iteration and am reopening/activating sheet A afte
pasteing in sheet b?

I can't understand what the problem is, basically if i choose to
remove the copy and paste code and just have the sheets open in th
loop 123 times it still goes at snails pace ie 5 seconds a loop! It
not the sheets that are a problem as i recorded a macro to test thi
problem and it runs at the normal speed that i desire.

ive been opening workbooks with following
Windows("intermediate.xls").Activate OR
bkI.Activate - where bki is a declared workbook

Any idea

--
cereldin
-----------------------------------------------------------------------
cereldine's Profile: http://www.excelforum.com/member.php...fo&userid=3206
View this thread: http://www.excelforum.com/showthread.php?threadid=53466


Jim Cone

speeding up copy and paste code
 
Sounds like you could copy the entire sheet (once) and then
delete the columns you don't need from the copied sheet.
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware


"cereldine"
wrote in message
Im developing some code that will look for values in about 15
spreadsheets that are provided for us externally (sheet A).
I need to extract about 115 columns of data out of about 123 by
determining the criteria, i can do this fine, i can also declare the
range i want to copy fine and if this code is run on its own it will
loop through to the end in seconds.

The code starts to slow down when i start adding the code to paste the
data into the required spreadsheet (sheet B), this has to be done one
coloumn at a time so as to ommit columns i don't need. the copy code
and paste code work really fast, the code slows down when ive
performed one iteration and am reopening/activating sheet A after
pasteing in sheet b?

I can't understand what the problem is, basically if i choose to i
remove the copy and paste code and just have the sheets open in the
loop 123 times it still goes at snails pace ie 5 seconds a loop! Its
not the sheets that are a problem as i recorded a macro to test this
problem and it runs at the normal speed that i desire.

ive been opening workbooks with following
Windows("intermediate.xls").Activate OR
bkI.Activate - where bki is a declared workbook

Any ideas


--
cereldine
------------------------------------------------------------------------
cereldine's Profile: http://www.excelforum.com/member.php...o&userid=32069
View this thread: http://www.excelforum.com/showthread...hreadid=534660



All times are GMT +1. The time now is 10:39 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com