Sub Worksheet_Change(ByVal Target As Range)
On Error GoTo Fin: If Target.Count > 1 Then Exit Sub
If Not Intersect(Target, [B2]) Is Nothing Then
Dim DL%, N%, tablo, T2, Valeur
Application.ScreenUpdating = False
DL = Sheets("Tirages").[A65500].End(xlUp).Row
tablo = Sheets("Tirages").Range("A1:A" & DL + 3)
[E1:E37].ClearContents
[D1:D37].Resize(37).Sort key1:=[D1:D37], order1:=xlAscending, Header:=xlNo
ReDim T2(0 To 40)
For N = 1 To UBound(tablo)
If tablo(N, 1) = Target Then
Valeur = tablo(N + 1, 1): T2(Valeur) = T2(Valeur) + 1
Valeur = tablo(N + 2, 1): T2(Valeur) = T2(Valeur) + 1
Valeur = tablo(N + 3, 1): T2(Valeur) = T2(Valeur) + 1
End If
Next N
[E1].Resize(37, 1).Value = Application.Transpose(T2)
[D1:E37].Resize(37).Sort key1:=[E1:E37], order1:=xlDescending, Header:=xlNo
End If
Fin:
Application.ScreenUpdating = True
End Sub