deleting multicolumn duplicate rows via a macro


Posted by Karl Bergerson on December 28, 2001 5:06 PM

I would like an efficient way to delete multicolumn duplicate rows within Excel. Assuming the range is defined and the definition of duplicate is that any cell in the row that is different from another row works to achieve uniqueness, then I want to delete all true duplicates.
Help!!!



Posted by Don Shave on December 29, 2001 12:50 PM

Best bet is to construct a loop like this:

set last_col to the rightmost column
set last_row to the bottom row

for this_col = 1 to last_col
sort data by this_col
for this_row = 1 to last_row
if cell (this_row, this_col) =
cell (this_row+1, this_col) then
delete this_row
decrement last_row and this_row
end if
next this_row
next this_col

If you have huge data sets (rows or cols) to process, this will be slow.