Sorting and delete records with macro

C

conio96

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..
 
N

Nikos Yannacopoulos

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top