ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Sorting and delete records with macro (https://www.excelbanter.com/excel-programming/282842-sorting-delete-records-macro.html)

conio96

Sorting and delete records with macro
 

Hi, I have a raw data file with very large size, for monthly data file,
it could be up to 20 to 30MB. Inside the files there are a lot of
columns and records that I don't need.

So, I have written a macro that will delete unwanted columns and rows
from the raw data files. When I run the marco, I realise that it is
very slow when the file is getting larger as it will go to the records
line by line to check whether it is wanted record.

For example, if the records contains "ABC", the macro will delete the
that whole record. Is there a way the I can program the macro to sort
the data file and search for the first appeared "ABC" and the last
appeared "ABC", then delete the whole range of the record?

or is there any other better way that can make the process faster?

Please advice..

Thanks a lot..


------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from http://www.ExcelForum.com/


Nikos Yannacopoulos[_5_]

Sorting and delete records with macro
 
Hi there,

Not sure how much speed you might gain this way given the
size of your file, but it's worth giving it a shot,
chances are it will be substantial... filter and delete
the filter selection rather than going line by line.
Also, in either case make sure you set screen updating to
false at the beginning of your code (and resetting to true
at the end) if you have not already done it, it makes a
hell of a difference!

Nikos
-----Original Message-----

Hi, I have a raw data file with very large size, for

monthly data file,
it could be up to 20 to 30MB. Inside the files there are

a lot of
columns and records that I don't need.

So, I have written a macro that will delete unwanted

columns and rows
from the raw data files. When I run the marco, I realise

that it is
very slow when the file is getting larger as it will go

to the records
line by line to check whether it is wanted record.

For example, if the records contains "ABC", the macro

will delete the
that whole record. Is there a way the I can program the

macro to sort
the data file and search for the first appeared "ABC" and

the last
appeared "ABC", then delete the whole range of the record?

or is there any other better way that can make the

process faster?

Please advice..

Thanks a lot..


------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from

http://www.ExcelForum.com/

.



All times are GMT +1. The time now is 06:22 AM.

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