Currently I have a macro that runs through a list and deletes duplicate values (in one column), but it’s proving to be very inefficient. For every entry that it checks for duplicates, it has to run through the whole column; my file currently has 50,000 entries and that is no small task.
I think an easier way for the macro to work is for the macro to check if this value is in an array. If it is, then remove the row that the entry is in. If it isn’t, add the value to the array.
Can someone provide some help with the basic outline of the macro? Thanks
The Below code will loop through your source data and store it in an array, while simultaneously checking for duplicates. After the collection is complete it uses the array as a key to know which columns to delete.
Due to the high number of potentiol screen updates with the deletion be sure to turn screenupdating off. (included)
As requested, here is a similar way to do it, using Collections instead of an Array for key indexing: (RBarryYoung)
Note that this method does not need to assume any datatype or integer limits for the values of the cells in the column.
(Mea Culpa: I had to hand-enter this in Notepad, because my Excel is busy running project tests right now. So there may be some spelling/syntax errors…)