Remove Duplicates

  • I have been searching the post for removing duplicates for long time but could not find it.


    Could anyone suggest only one line for removing all duplicate entries from column B7 to end of the line and adjusting the spaces accordingly.

  • Re: Remove Duplicates


    Hi..


    This... straight from the Macro Recorder:


    Code
    Sub Macro1()
    '
    ' Macro1 Macro
    '
        Range("B7:B15").Select
        ActiveSheet.Range("$B$7:$B$15").RemoveDuplicates Columns:=1, Header:=xlNo
    End Sub


    Can be made to be applied to a varying length in Column B like this:


    Code
    ActiveSheet.Range("B7:B" & Range("B" & Rows.Count).End(xlUp).Row).RemoveDuplicates Columns:=1, Header:=xlNo
  • Re: Remove Duplicates


    Your code works perfectly fine but small error pops up.


    I have created a macro wherein list of all items in particular month is copied.
    Wherever there are 2 or more items your code works fine. Even when no items is present the code works fine.


    But in certain cases where there are only 1 item debug error pops up.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!