olivier35530
XLDnaute Nouveau
Bonjour, quelle fonction choisir pour eviter les doublons dans une colonne et l'oubli dans la meme colonne merci pour votre aide
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
If IsEmpty(Target.Value) Then Exit Sub
If Target.Count > 1 Then Exit Sub
If Target.Column < 2 Then Exit Sub
With Range(Cells(1, Target.Column).Address & ":" & Cells(Target.Row - 1, Target.Column).Address & "," & Cells(Target.Row + 1, Target.Column).Address & ":" & Cells(Rows.Count, Target.Column).Address)
Set c = .Find(Target.Value, , , xlWhole)
If Not c Is Nothing Then
MsgBox "Data already exists at range: " & c.Address(0, 0)
Target.Value = ""
End If
End With
End Sub