ANmaRemoveDuplicates

Removes duplication in table in 1 or more columns using Excel "RemoveDuplicates" feature.
Will work in sheet, cleaning table from duplication in one or more columns.
Similar to CreateUniqueList but works in same table, does not copy into another sheet and removes based on more than 1 column.
As usual, caller can decide sheet, workbook, list of columns to consider for duplicates (with separator) and if table has header or not

CodeFunctionName
What is this?

Public

Tested

Original Work
Sub ANmaRemoveDuplicates(RData, Optional DupCols = "A|B|C", Optional Sepa = "|", Optional HaveHeaders = xlYes, Optional Shee = "Active", Optional WB = "This")
    ' Remove duplicates from a range based on 1 or more columns
    '
    If WB = "This" Then WB = ThisWorkbook.Name
    If WB = "Active" Then WB = ActiveWorkbook.Name
    If Shee = "Active" Then Shee = ActiveSheet.Name
   
    Set Arr9 = Split(DupCols, Sepa)
    Workbooks(WB).Worksheets(Shee).Range(RData).RemoveDuplicates Columns:=Arr9, Header:=HaveHeaders
    ' ThisWorkbook.Worksheets(ShFilterTo).Range(RSource).RemoveDuplicates Columns:=Array(1, 2), Header:=xlYes
End sub

RData, Optional DupCols = "A|B|C", Optional Sepa = "|", Optional HaveHeaders = xlYes, Optional Shee = "Active", Optional WB = "This"

Views 93

Downloads 37

CodeID
DB ID