Bonjour,
Ci-dessous, un exemple à adapter.
C'est une procédure évènementielle qui va se produire à chaque modification de A1.
Il y a une variable publique bAllow pour autoriser ou ne pas autoriser la procédure à s'exécuter.
Il faut penser à l'initialisation de A1.
Cdlt.
Option Explicit
Public bAllow As Boolean
Private Sub Worksheet_Change(ByVal Target As Range)
Dim oldValue, newValue
If Target.Address = "$A$1" And bAllow = True Then
On Error GoTo err_Handler
Application.EnableEvents = False
newValue = Target.Value
Application.Undo
oldValue = Target.Value
Select Case newValue - oldValue
Case 1
MsgBox "+1"
Case 2
MsgBox "+2"
Case 3
MsgBox "+3"
Case Else
'
End Select
End If
exit_Handler:
Target.Value = newValue
Application.EnableEvents = True
Exit Sub
err_Handler:
MsgBox "Erreur : " & Err.Number & " - " & Err.Description
Resume exit_Handler
End Sub