Private Sub Worksheet_Change(ByVal Target As Range)
'auteur code d'origine: JBeaucaire
Dim cell As Range, MyStr As String, Ans As String
If Not Intersect(Target, Columns("A")) Is Nothing Then
For Each cell In Intersect(Target, Columns("A"))
If Len(cell.Value) > 20 Then
MyStr = cell
Do
Ans = Application.InputBox("Cette cellule ne peut contenir plus de 20 caractères, contrôlez votre saisie.", _
"Limitation nombre de caractères", MyStr, Type:=2)
If Ans = "False" Then
'Loop will restart
ElseIf Len(Ans) <= 20 Then
cell = Ans
Exit Do
Else
MyStr = Ans
End If
Loop
End If
Next cell
End If
End Sub