Sub RemoveSomeDupInfo()
Dim rng As Range, delRng As Range, dataRws As Long
Dim dStr As String, v1(1 To 3), v2(1 To 3), ctr As Long
Set rng = ActiveSheet.Range("a1").CurrentRegion
dataRws = rng.Rows.Count - 1
Set rng = rng.Offset(1, 0).Resize(dataRws)
Set delrws = Nothing
For Each rw In rng.Rows
For i = 1 To 3
v1(i) = rw.Cells(1, i)
v2(i) = rw.Offset(1, 0).Cells(1, i)
If v1(i) <> v2(i) Then
Exit For
Else
ctr = ctr + 1
End If
If ctr = 3 Then
If delrws Is Nothing Then
Set delrws = rw.Offset(1, 0).Resize(, 3)
Else
Set delrws = Union(delrws, rw.Offset(1, 0).Resize(, 3))
End If
End If
Next i
ctr = 0
Next rw
If delrws Is Nothing Then
MsgBox "No duplicates found"
Else
delrws.ClearContents
End If
End Sub
Welcome to the board Excelos. Try this on a copy of your worksheet:
Code:Sub RemoveSomeDupInfo() Dim rng As Range, delRng As Range, dataRws As Long Dim dStr As String, v1(1 To 3), v2(1 To 3), ctr As Long Set rng = ActiveSheet.Range("a1").CurrentRegion dataRws = rng.Rows.Count - 1 Set rng = rng.Offset(1, 0).Resize(dataRws) Set delrws = Nothing For Each rw In rng.Rows For i = 1 To 3 v1(i) = rw.Cells(1, i) v2(i) = rw.Offset(1, 0).Cells(1, i) If v1(i) <> v2(i) Then Exit For Else ctr = ctr + 1 End If If ctr = 3 Then If delrws Is Nothing Then Set delrws = rw.Offset(1, 0).Resize(, 3) Else Set delrws = Union(delrws, rw.Offset(1, 0).Resize(, 3)) End If End If Next i ctr = 0 Next rw If delrws Is Nothing Then MsgBox "No duplicates found" Else delrws.ClearContents End If End Sub