0

I've been searching for a while but haven't really found an answer, so I thought I'd post.

enter image description here

I can't really write any codes, but I've tried using the following:

Sub DeleteDuplicate()
Dim current As String
ActiveSheet.Range("A1").Activate
Do While ActiveCell.Value <> ""
    current = ActiveCell.Address
    ActiveCell.Offset(1, 0).Activate
    Do While ActiveCell.Value <> ""
    If (ActiveSheet.Range(current).Value = ActiveCell.Value) And     (ActiveSheet.Range(current).Offset(0, 2).Value = ActiveCell.Offset(0, 2).Value) And (ActiveSheet.Range(current).Offset(0, 3).Value = ActiveCell.Offset(0, 3).Value) Then
        ActiveSheet.Rows(ActiveCell.Row).Delete
    Else
    ActiveCell.Offset(1, 0).Activate
    End If
    Loop
    ActiveSheet.Range(current).Offset(1, 0).Activate
Loop
End Sub

Basically, using the example I've linked above, this is meant to go through the entire rows down the columns, and if there are entire rows that are the same, one of the duplicates is deleted.

I'd like to know if there is a better way of doing this when instead of 3 columns there are about 18 columns and 10,0000 rows.

1

No need to re-invent the wheel.

Data > Remove Duplicates > Select which columns to compare > OK

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.