Private Sub Worksheet_Change(ByVal Target As Range) 'à l'édition dans une cellule
Dim pl1 As Range 'déclare la variable pl1 (PLage 1)
Dim pl2 As Range 'déclare la variable pl2 (PLage 2)
Set pl1 = Range("C13:C200") 'définit la plage 1
Set pl2 = Range("P13:P200") 'définit la plage 2
'condition 1 : si l'édition à lieu dans la plage pl1
If Not Application.Intersect(Target, pl1) Is Nothing Then
'condition 2 : si l'édition est "e" ou "E'
If UCase(Target.Value) = "E" Then
Target.Value = Now 'place la date et heure
Target.Value = Format(Now, "hh:mm:ss") 'met au format
Target.Offset(0, 1).Select 'déplace vers la droite
End If 'fin de la condition 2
End If 'fin de la condition 1
'condition 1 : si l'édition à lieu dans la plage pl2
If Not Application.Intersect(Target, pl2) Is Nothing Then
'condition 2 : si l'édition est "s" ou "S'
If UCase(Target.Value) = "S" Then
Target.Value = Now 'place la date et heure
Target.Value = Format(Now, "hh:mm:ss") 'met au format
Target.Offset(0, 1).Select 'déplace vers la droite
End If 'fin de la condition 2
End If 'fin de la condition 1
End Sub