Option Explicit
'Variables de dernière ligne :
' dl1 : lastline_notes2 ; dernière ligne, selon colonne A
' dl2 : lastline_name2 ; dernière ligne, selon colonne B
' dl3 : dernière ligne, selon colonne D
' dlg : max de dl2 et dl3, pour effacer anciennes données
Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Feuil8.[C5]) Is Nothing Then Exit Sub
Dim nlm&, dl1&, dl2&, dl3&, dlg&, i%, j&
nlm = Rows.Count: Application.ScreenUpdating = 0
dl2 = Feuil8.Cells(nlm, 2).End(3).Row: dlg = dl2
dl3 = Feuil8.Cells(nlm, 4).End(3).Row: If dl3 > dl2 Then dlg = 3
If dlg > 9 Then [B9].Resize(dlg - 8, 2).ClearContents
With Worksheets("Notes")
dl1 = .Cells(nlm, 1).End(3).Row 'doit être avant la boucle For i !!!
For i = 11 To 1000 Step 8
If [C5] = .Cells(15, i) Then
For j = 19 To dl1
If IsNumeric(.Cells(j, i)) Then
If .Cells(j, i) >= Feuil8.[C3] Then
dl2 = dl2 + 1
Cells(dl2, 2) = .Cells(j, 2): Cells(dl2, 3) = .Cells(j, i)
If i > 13 Then
'comme je ne sais pas bien quelles sont les données,
'il faudra sans doute adapter le .Cells(j, i) ici :
Cells(dl2, 4) = .Cells(j, 4): Cells(dl2, 5) = .Cells(j, i)
End If
End If
End If
Next j
End If
Next i
End With
End Sub