Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 593
Default Bulk Row Deletion - Fastest method

quartz wrote ...
I have tried several different methods of deleting a lot of rows quickly.

I use test data in a single Excel sheet containing 54,102 rows by 22
columns. This data contained 24,266 rows targeted for deletion

The fastest method I have found in benchmarking tests is to... use
a "For...Each" loop to mark the rows for deletion in the sheet <snip

This ran fastest (6.5 minutes - which still seems like a long time when you
have to do it repeatedly). Does anyone know of a faster method?


Try this approach:

- copy the sheet to a new blank workbook;
- save and close this temp workbook;
- use a SQL query on the closed temp workbook to create an in-memory
ADO recordset of the data you want to *keep* (if you don't specify an
ORDER BY clause then the existing sort order will be retained);
- delete all the data in the original sheet;
- use CopyFromRecordset to populate the original sheet using the
retained data.

This should easily run in under 6.5 seconds... I'm sorry, did you say
*minutes*?!

Jamie.

--
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Fastest Way to Filter/Delete SyrHoop Excel Worksheet Functions 6 November 10th 04 06:33 PM
Bulk row deletion quartz[_2_] Excel Programming 1 November 9th 04 05:00 PM
Fastest way to enter many formulas ob3ron02[_15_] Excel Programming 0 October 27th 04 05:08 PM
Fastest way for comparing columns? Tony Excel Programming 4 July 17th 04 04:02 AM
Fastest way to do this? Abu Ali Excel Programming 4 January 12th 04 09:24 AM


All times are GMT +1. The time now is 08:31 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"