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

Joe Reichsfeld
Joe Reichsfeld used Ask the Experts™
on
Hello,

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.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Martin LissOlder than dirt
Most Valuable Expert 2017
Distinguished Expert 2018

Commented:
If you could attach a small sample workbook with 3 or 4 columns it would help.
Excel & VBA Expert
Most Valuable Expert 2018
Awarded 2015
Commented:
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

Joe ReichsfeldFounder, Owner, Business Consultant

Author

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 Expert
Most Valuable Expert 2018
Awarded 2015

Commented:
You're welcome Joe! Glad it worked as desired.
Thanks for the feedback.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial