Hi All
I'm using the below code to prevent/remove duplicate in my sheet.
The problem with this code is, that it looks for duplicates in column A which is what I want but when ir finds the duplicate it removes data only from column A is the any way to modifiy existing code so that it will remove data from columns A,B,C,D?? I'm using userfrom to capture data and only need to look for duplicates in column A but if one found than everything from that row should be removed...
Thank you for your help
Dan
Dim r As Range
Dim ans As String
Const myCol As Long = 1
If Intersect(Target, Columns(myCol)) Is Nothing Then Exit Sub
Application.EnableEvents = False
For Each r In Intersect(Target, Columns(myCol))
If Application.CountIf(Columns(myCol), r.Value) > 1 Then
MsgBox (r.Value & " already exists")
r.ClearContents
End If
Next
Application.EnableEvents = True
End Sub
Bookmarks