1
votes

I was wondering if anyone would know of any VBA code that would get rid of duplicates. For example, in Column D, I want to keep the first instance of the ID, and get delete the duplicate(s).

enter image description here

Regards

Greg

1
can you insert a Picture of the Tabel, how it locks like?Moosli
If you insert 4 spaces at the beginning of a line, the whole line will display in a fixed sized font. You can then space out the line to create columns. I assume the string above is meant to be a before image. Please supply an after image as well so people can understand what you seek.Tony Dallimore

1 Answers

4
votes

Ok, that should work for you. That Routine delets all double Id'd in the Column C

Option Explicit


Sub DeletDuplicate()
    Dim x As Long
    Dim LastRow As Long
    LastRow = Range("C65536").End(xlUp).Row
    For x = LastRow To 1 Step -1
        If Application.WorksheetFunction.CountIf(Range("C1:C" & x), Range("C" & x).Text) > 1 Then
            Range("C" & x).EntireRow.Delete
        End If
    Next x
End Sub