• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Remove/Delete duplicate rows from 5 columns

I want to remove/delete all duplicate rows from 5 columns which have no headers.
I have recorded operation in macro and code is here:
Code:
Sub Macro11()
    Columns("D:D").Select
    Selection.SpecialCells(xlCellTypeConstants, 23).Select
    ActiveSheet.Range("$A$1:$E$8").RemoveDuplicates Columns:=Array(1, 2, 3, 4, 5), _
        Header:=xlNo
    Range("A1").Select
End Sub
I want above range to be variable as my count of rows will be varying.
I have compared column 'C' to remove duplicates. It will be OK to compare each row or cells only from coulmn 'D'.
 

Attachments

  • Capture.PNG
    Capture.PNG
    37.4 KB · Views: 5
Last edited:
I want to remove/delete all duplicate rows from 5 columns which have no headers.
I have recorded operation in macro and code is here:
Code:
Sub Macro11()
    Columns("D:D").Select
    Selection.SpecialCells(xlCellTypeConstants, 23).Select
    ActiveSheet.Range("$A$1:$E$8").RemoveDuplicates Columns:=Array(1, 2, 3, 4, 5), _
        Header:=xlNo
    Range("A1").Select
End Sub
I want above range to be variable as my count of rows will be varying.
I have compared column 'C' to remove duplicates. It will be OK to compare each row or cells only from coulmn 'D'.
Hi,

You can use:
Code:
Sub Macro11()
    ActiveSheet.Range("A:E").RemoveDuplicates Columns:=4, Header:=xlNo
End Sub

By using the whole columns you don't need to worry about the amount of rows... it will consider them all... it will remove duplicates found in "D".
 
Back
Top