Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
I use some Excel VBA code repeatedly to extract data from text files, then to paste into new Excel workbooks, created from a template. Now the code has worked successfully in the past, and for my current application is taking 45 seconds to run. In order to make my code more robust, I have added one line of code that clears the contents of the template worksheet, before I paste in the new data. In this way, I don't need to worry whether the previous template "dummy" data has been overwritten. The line of code is thus:- Worksheets("Loads").Range("A1:H65536").Clear Nothing too fancy you might think! However, this one extra line of code has meant the code now takes 5 minutes to run, as opposed to 45 seconds. Any thoughts anybody? (I have noticed this kind of slow-down in the past: if for example I write data to the template, then copy and paste it into the new workbook, there is no slowdown. If I create the workbook, then write data directly to the workbook, it takes exponentially longer.) Thanks in advance for any thoughts, Paul. p.s. It is nothiong obvious like I have nested the Clear command within the extraction loops; it is standalone, before any loops, and right after I have created the new workbook from the template. |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Copy command is slow in 2007 | Excel Discussion (Misc queries) | |||
Command button to clear inputs | Excel Discussion (Misc queries) | |||
excel command to clear contents except 2 formulas | Excel Discussion (Misc queries) | |||
How do i clear a cell using a command button? | Excel Discussion (Misc queries) | |||
shell command running very slow | Excel Programming |