Ik heb onderstaande code voor het controleren van dubbele waardes, alleen werkt deze alleen als je de gegevens invoert in deze kolom. Nu worden bij mij de waardes in deze kolom gekopieerd vanaf een ander tabblad en werkt deze code niet. Nu is mijn vraag hoe kan ik deze code aanpassen zodat deze wel werkt.
Private Sub Worksheet_Change(ByVal Target As Range)
With Target
If .Column > 2 Or .Cells.Count > 1 Then Exit Sub
If WorksheetFunction.CountIf(Columns(.Column), .Value) > 1 Then
Application.DisplayAlerts = False
.ClearContents
Application.DisplayAlerts = True
MsgBox "Bestaat reeds!"
End If
End With
End Sub
Private Sub Worksheet_Change(ByVal Target As Range)
With Target
If .Column > 2 Or .Cells.Count > 1 Then Exit Sub
If WorksheetFunction.CountIf(Columns(.Column), .Value) > 1 Then
Application.DisplayAlerts = False
.ClearContents
Application.DisplayAlerts = True
MsgBox "Bestaat reeds!"
End If
End With
End Sub