Private Sub Worksheet_Change(ByVal Target As Excel.Range)
If Target.Column = 6 Then
If Application.WorksheetFunction. _
CountIf(Range("F:F"), Target.Value) > 1 Then
MsgBox "Saisissez un autre numéro, celui-ci existe déjà"
Target.Value = "PAS VALIDE"
Target.Font.ColorIndex = 3
Target.Font.Bold = True
End If
End If
End Sub
Si j'exécute par erreur 2x la même entrée, c'est-à-dire que le même N°
d'article est entré deux fois, le MsgBox "Saisissez un autre numéro, celui-ci
existe déjà", reste coincé.
Y a t-il une solution pour remédier à ce problème ?
Merci d'avance de votre aide et à +
Le hasard fait bien les choses, c'est impeccable, plus de problème avec ce code d'erreur Merci à tous les deux de votre précieuse aide A une prochaine fois si besoin
Cordiales salutations
frasax
Bonjour,
A tout hasard, essayez
''************ Private Sub Worksheet_Change(ByVal Target As Excel.Range) If Target.Column <> 6 Then Exit Sub If CStr(Target.Value) = "PAS VALIDE" Then Exit Sub If Application.WorksheetFunction. _ CountIf(Range("F:F"), Target.Value) > 1 Then MsgBox "Saisissez un autre numéro, celui-ci existe déjà" Target.Value = "PAS VALIDE" Target.Font.ColorIndex = 3 Target.Font.Bold = True End If End Sub ''************
Cordialement.
PMO Patrick Morange
Bonjour PMO,
Le hasard fait bien les choses, c'est impeccable, plus de problème
avec ce code d'erreur
Merci à tous les deux de votre précieuse aide
A une prochaine fois si besoin
Cordiales salutations
frasax
Bonjour,
A tout hasard, essayez
''************
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
If Target.Column <> 6 Then Exit Sub
If CStr(Target.Value) = "PAS VALIDE" Then Exit Sub
If Application.WorksheetFunction. _
CountIf(Range("F:F"), Target.Value) > 1 Then
MsgBox "Saisissez un autre numéro, celui-ci existe déjà"
Target.Value = "PAS VALIDE"
Target.Font.ColorIndex = 3
Target.Font.Bold = True
End If
End Sub
''************
Le hasard fait bien les choses, c'est impeccable, plus de problème avec ce code d'erreur Merci à tous les deux de votre précieuse aide A une prochaine fois si besoin
Cordiales salutations
frasax
Bonjour,
A tout hasard, essayez
''************ Private Sub Worksheet_Change(ByVal Target As Excel.Range) If Target.Column <> 6 Then Exit Sub If CStr(Target.Value) = "PAS VALIDE" Then Exit Sub If Application.WorksheetFunction. _ CountIf(Range("F:F"), Target.Value) > 1 Then MsgBox "Saisissez un autre numéro, celui-ci existe déjà" Target.Value = "PAS VALIDE" Target.Font.ColorIndex = 3 Target.Font.Bold = True End If End Sub ''************