find and delete duplicates
I have a Word file with image names on each line. For example,
abc_bw.jpg
def_zq.jpg
img45cdgf.jpg
abc_logo.jpg
def_zq.jpg
img45cdgf.jpg
abc_bw.jpg
I have VBA code that selects the first line, compares the selected line with the following line, if the lines match the duplicate line is deleted, then the cursor moves down to the next line and compares that line to the selected line. When it reaches end, the "selected" line moves down one line and the process repeats until each line is compared with all the following lines and all duplicate lines have been deleted. This works ok for 5 or 6 lines, but with each additional line the time it take to process increases exponentially. Does anyone have any better ideas for how to find and delete the duplicate lines? Maybe with some sort of array? Thanks for any help you can provide.
|