Private Sub Worksheet_Activate()
'crée la liste des DR, sans doublons
Dim tablo, d As Object, t
tablo = Sheets("Import").Range("E2", Sheets("Import").[E65536].End(xlUp))
Set d = CreateObject("Scripting.Dictionary")
For Each t In tablo
If t <> "" Then d(t) = ""
Next
[J2].Resize(d.Count) = Application.Transpose(d.keys)
Range("J" & d.Count + 2 & ":J65536").ClearContents
[J2].Resize(d.Count).Sort [J2], Header:=xlNo 'tri
End Sub
Private Sub Worksheet_Change(ByVal Target As Range)
'liste les 25 plus petits et 25 plus grands boottimes
If Intersect(Target, [D1]) Is Nothing Then Exit Sub
Dim v As String, tablo, i As Long, t(), n As Long
v = [D1]
tablo = Sheets("Import").Range("A2:E" & Sheets("Import").[B65536].End(xlUp).Row)
For i = 1 To UBound(tablo)
If tablo(i, 5) = v And tablo(i, 2) > 0 Then
ReDim Preserve t(4, n)
t(0, n) = tablo(i, 1)
t(1, n) = tablo(i, 2)
t(2, n) = tablo(i, 3)
t(3, n) = tablo(i, 4)
t(4, n) = tablo(i, 5)
n = n + 1
End If
Next
Application.ScreenUpdating = False
[A4:E65536].ClearContents 'RAZ
If n Then
Range("A4:E" & n + 3) = Application.Transpose(t)
Range("A4:E" & n + 3).Sort [B4], Header:=xlNo 'tri
End If
If n > 50 Then Range("A29:E" & n - 22).Delete xlUp
End Sub