You need to tell the Range.RemoveDuplicates method which column to use. In addition, since you stated that you have a title bar, you must specify the .RemoveDuplicates method.
Sub dedupe_abcd() Dim icol As Long With Sheets("Sheet1") '<-set this worksheet reference properly! icol = Application.Match("abcd", .Rows(1), 0) With .Cells(1, 1).CurrentRegion .RemoveDuplicates Columns:=icol, Header:=xlYes End With End With End Sub
The source code seemed to want to remove duplicates from one column while ignoring the surrounding data. This scenario is not typical, and I included the surrounding data so that the .RemoveDuplicates process does not scramble your data. Post a comment if you really want to isolate the RemoveDuplicates process to one column.
source share