Bulk Row Deletion - Fastest method
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 that were
interspersed within the data (all based on actual events routinely
encountered).
The fastest method I have found in benchmarking tests is to:
1. Use a "For...Each" loop to mark the rows for deletion in the sheet
2. Sort the data so that all the target rows are together
3. Delete all the target rows at the same time
4. If necessary, re-sort the data
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? If so, could
you please post your method? FYI, other methods I tried:
1. Copy target row numbers into an array, then step backward through the
array and delete the rows.
2. Filter the target rows, then delete the visible range.
3. Step backward through all rows in the sheet and immediatley delete any
target rows encountered.
4. These are all the methods I could think of. Anyone else have any ideas to
shave some time off of this process?
Thanks much in advance.
|