Posts1Registration dateFriday February 28, 2020StatusMemberLast seenFebruary 28, 2020
Feb 28, 2020 at 09:07 AM
Posts2921Registration dateSunday September 12, 2010StatusModeratorLast seenJanuary 16, 2023
Mar 3, 2020 at 12:17 PM
I have been struggling to find a code that allows me to select multiple columns by name to then delete duplicates in those specific columns. The reason behind this is the workbook i am using will soon be adding columns and i need to specifically reference these exact columns rather than the numerical placement of the columns. If anyone can help that would be great!
Posts2921Registration dateSunday September 12, 2010StatusModeratorLast seenJanuary 16, 2023549 Mar 3, 2020 at 12:17 PM
Having a second look at your title, the following code might be what you are after:
For Each cell In Range(Cells(1, 1), Cells(1, Columns.Count).End(xlToLeft))
If cell.Value = "Dupes" Then
Range(Cells(2, cell.Column), Cells(Cells(Rows.Count, cell.Column).End(xlUp).Row, cell.Column)).RemoveDuplicates Columns:=1
Every column with a header named "Dupes" will get it's dupes removed. Change the word Dupes on the 3rd code line if you have/want another header name to trigger the removal of duplicates.