Link to home
Start Free TrialLog in
Avatar of greg_c
greg_c

asked on

VBA to get rid of duplicates - Excel 2003

Hi

I was wondering if anyone would anyone know of any VBA code that would get rid of duplicates.  For example, in Column D, I want to keep the first instance of the ID, and get delete the duplicate(s).

I have attached the a file with data.

I am using Excel 2003.  



Regards

Greg
Avatar of dlmille
dlmille
Flag of United States of America image

There is no attachment.

However, you can do this without VBA.

Put this in column E (assuming header on row one, start with E2):

[E2]=IF(COUNTIF($D$2:$D2,$D2)>1,1,0)

and copy down.

You can then filter the range on column E for 1, and delete those rows.

Dave
ASKER CERTIFIED SOLUTION
Avatar of dlmille
dlmille
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of greg_c
greg_c

ASKER

Perfect, thank you very much.