Removing duplicates from multiple lists

Steve_nyc92

New Member
Joined
Dec 17, 2020
Messages
23
Office Version
  1. 2016
Platform
  1. Windows
Hi

I searched the forum and was unable to find answer to this. I have a file with 200 columns that contain unique lists starting in column M. Each list has values that are unique from the other lists but are duplicated within the list itself.

I want to remove the duplicated values from each list so I only see the unique ones. I can’t use the excel function because it looks at all the lists as one group. I don’t want to individually remove from each list as it is over 200 columns.

Is there a macro that can do this?
 

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
Try this:

VBA Code:
Sub RemovingDuplicates()
  Dim j As Long, lc As Long
  Application.ScreenUpdating = False
  lc = ActiveSheet.Cells.Find("*", , xlValues, , xlByColumns, xlPrevious).Column
  
  For j = Columns("M").Column To lc
    Range(Cells(1, j), Cells(Rows.Count, j).End(3)).RemoveDuplicates 1, xlYes
  Next
  Application.ScreenUpdating = True
End Sub
 
Upvote 0
Try this:

VBA Code:
Sub RemovingDuplicates()
  Dim j As Long, lc As Long
  Application.ScreenUpdating = False
  lc = ActiveSheet.Cells.Find("*", , xlValues, , xlByColumns, xlPrevious).Column
 
  For j = Columns("M").Column To lc
    Range(Cells(1, j), Cells(Rows.Count, j).End(3)).RemoveDuplicates 1, xlYes
  Next
  Application.ScreenUpdating = True
End Sub
This worked great! Only one thing I forgot to mention is the name of the list is in row 2. So it should actually start removing duplicates in M3 to the last column/row
 
Upvote 0
Change this:
Range(Cells(1, j), Cells(Rows.Count, j).End(3)).RemoveDuplicates 1, xlYes

For this:
Range(Cells(2, j), Cells(Rows.Count, j).End(3)).RemoveDuplicates 1, xlYes
 
Upvote 0
Solution

Forum statistics

Threads
1,214,605
Messages
6,120,473
Members
448,967
Latest member
visheshkotha

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top