Delete duplicate rows in a listobject

  • Hi, I have a need to remove rows from a list object but only if the entire row is a duplicate.

    I have toe following code that works on 1 column but not the row.

    Sub remove_duplicates_city()
    Set Rng = ActiveWorkbook.Sheets("City_Report").ListObjects("City_Data").DataBodyRange
    End Sub

    Any ideas on how to approach this?


  • Re: Delete duplicate rows in a listobject

    Refer to the ListObject itself, not the databody range, then specify the columns to use to determine duplicates. You should also indicate if the table has headers or not, don't use the 'Guess' option

    rng.RemoveDuplicates Columns:=Array(2, 3, 4), Header:=Yes

    Standard warning - test on a copy of the data, no prompt to confirm is shown.

Participate now!

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