Hello
I have this code prevent adding duplicates items for column D , but I want to change it to multiple columns ( D:H , K:M )
thanks
I have this code prevent adding duplicates items for column D , but I want to change it to multiple columns ( D:H , K:M )
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column = 4 And Len(Target.Value) > 0 Then
Application.EnableEvents = False
If WorksheetFunction.CountIf(Range("D:D"), Target.Value) > 1 Then
MsgBox Target.Value & " is a duplicate entry. It will be removed.", vbExclamation, "Data Entry Editor" & "(INDEX(C7:C23,MATCH(Target.Value,D7:D23,0))"
Target.ClearContents
End If
Application.EnableEvents = True
End If
End Sub