Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Count > 1 Then Exit Sub
If Target.Column = 2 And Target.Row > 21 Then
Dim Cel As Range, Plage As Range, Dico, Dico2, i As Byte, DerL As Integer, OK As Boolean, Tablo, Temp
Set Dico = CreateObject("Scripting.Dictionary")
Set Dico2 = CreateObject("Scripting.Dictionary")
DerL = Target.Row
Set Plage = Range("N" & DerL - 4 & ":Q" & DerL)
For Each Cel In Plage
If Cel <> 50 Then Dico2(CStr(Cel)) = ""
Next
For Each clé In Dico2.keys
If Not Dico2.Exists(CStr(clé - 1)) Then Dico(CStr(clé - 1)) = ""
If Not Dico2.Exists(CStr(clé + 1)) Then Dico(CStr(clé + 1)) = ""
Next
If Dico.Exists("-1") Then
Dico.Remove ("-1")
Dico("36") = ""
End If
If Dico.Exists("37") Then
Dico.Remove ("37")
Dico("0") = ""
End If
Tablo = Dico.keys
While Not OK
OK = True
For i = LBound(Tablo) To UBound(Tablo) - 1
If CInt(Tablo(i)) > CInt(Tablo(i + 1)) Then
Temp = Tablo(i)
Tablo(i) = Tablo(i + 1)
Tablo(i + 1) = Temp
OK = False
End If
Next
Wend
Cells(DerL, 18).Resize(1, Dico.Count) = Tablo
End If
End Sub