re-bonjour,
vérifie que la procédure s'exécute bien
rajoute un msgbox dans ton code comme ceci, le message "la procédure s'exécute" devrait s'afficher lorsque tu sélectionnes une valeur en colonne D.
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
Dim plg As Range
Dim tableau() As Long
Dim Nbr As Long
Dim annee As String
Dim cherche
Dim n As Long
Dim li As Long
Dim x As Long
Dim y As Long
Dim z As Long
Dim ColAnnee As Long
Dim ColTest As Long
Dim ColIncrement As Long
' noter les n° de colonne respectivement pour :
' ColTest pour la colonne du Résultat test
' ColIncrement pour la colonne du Numéro d'incrémentation
' ColAnnee pour la colonne de l'année
'
' pour la col A noter 1 - pour la col B noter 2 - pour la col C noter 3
' etc...
'
ColTest = 4
ColIncrement = 7
ColAnnee = 2
'-------------------------- ici
MsgBox "la procédure s'exécute"
'--------------------------
Application.EnableEvents = False
If Target.Column <> ColTest Then GoTo lafin
If Target.Count > 1 Then GoTo lafin
If Target.Value <> "vrai" Then Cells(Target.Row, ColIncrement) = "": GoTo lafin
n = Cells(Rows.Count, ColAnnee).End(xlUp).Row
annee = Cells(Target.Row, ColAnnee)
Set plg = Range(Cells(4, ColAnnee), Cells(n, ColAnnee))
Nbr = Application.CountIf(plg, annee)
'le tableau est sur-dimensionné, pour éviter une erreur
'dans la dernière boucle en fin de routine
ReDim tableau(Nbr)
li = plg.Find(annee, LookIn:=xlValues).Row - 1
For Each cherche In Range(Cells(li, ColAnnee), Cells(n, ColAnnee))
If cherche.Value = annee Then
x = cherche.Row
If Trim(Cells(x, ColTest)) = "vrai" Then
y = y + 1
z = Val(Cells(x, ColIncrement))
tableau(z) = x
If Cells(x, ColIncrement) = "" And z > 0 Then Cells(x, ColIncrement) = z: GoTo lafin
End If
End If
Next cherche
n = 0
For x = 1 To y
If tableau(0) > 0 Then
If tableau(x) > 0 Then n = x
If tableau(x) = 0 Then
Cells(tableau(0), ColIncrement) = x
GoTo lafin
End If
End If
Next x
lafin:
Application.EnableEvents = True
End Sub