need to remove duplicates in a column one column at a time


I have 3000 columns, each column containing duplicate values.  I was able to sort each column individually but now I need to remove duplicate values from each column individually while leaving the unique without affecting any other column.  Ive tried several ways but each fails.  Any assistance is appreciated.
Joe ReichsfeldFounder, Owner, Business ConsultantAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Martin LissOlder than dirtCommented:
If you could attach a small sample workbook with 3 or 4 columns it would help.
Subodh Tiwari (Neeraj)Excel & VBA ExpertCommented:
This small macro will remove duplicates from each individual column without affecting the data in other columns.
Sub RemoveDuplicates()
Dim lc As Long, c As Long
Application.ScreenUpdating = False

'Assuming the Row1 is the header row
lc = Cells(1, Columns.Count).End(xlToLeft).Column
For c = 1 To lc
    Columns(c).RemoveDuplicates Columns:=1, Header:=xlYes
Next c
Application.ScreenUpdating = True
End Sub

Open in new window


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Joe ReichsfeldFounder, Owner, Business ConsultantAuthor Commented:
Thank you both.  Martin, I normally do post samples, but Neeraj answered it with the solution before I got back to the question.   Neeraj - Thank you very much that was quick and painless.  I had been trying to do this since last night but the vba solution I was using kept locking everything up and crashing.   thank you for your assistance.
Subodh Tiwari (Neeraj)Excel & VBA ExpertCommented:
You're welcome Joe! Glad it worked as desired.
Thanks for the feedback.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Office

From novice to tech pro — start learning today.