1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
|
Sub TriFichRec()
Dim w As Integer, z As Integer, Temp As String
For w = 0 To UserForm11.ListBox1.ListCount - 1
For z = w + 1 To UserForm11.ListBox1.ListCount - 1
Debug.Print Mid(UserForm11.ListBox1.List(w), 1, InStr(1, UserForm11.ListBox1.List(w), " ") - 1)
Debug.Print UserForm11.ListBox1.List(w)
Debug.Print Mid(UserForm11.ListBox1.List(z), 1, InStr(1, UserForm11.ListBox1.List(z), " ") - 1)
Debug.Print UserForm11.ListBox1.List(z)
If Mid(UserForm11.ListBox1.List(w), 1, InStr(1, UserForm11.ListBox1.List(w), " ") - 1) < Mid(UserForm11.ListBox1.List(z), 1, InStr(1, UserForm11.ListBox1.List(z), " ") - 1) Then
Temp = UserForm11.ListBox1.List(w)
UserForm11.ListBox1.List(w) = UserForm11.ListBox1.List(z)
UserForm11.ListBox1.List(z) = Temp
End If
If Mid(UserForm11.ListBox1.List(w), 1, InStr(1, UserForm11.ListBox1.List(w), " ") - 1) = Mid(UserForm11.ListBox1.List(z), 1, InStr(1, UserForm11.ListBox1.List(z), " ") - 1) Then
If UserForm11.ListBox1.List(w) < UserForm11.ListBox1.List(z) Then
Temp = UserForm11.ListBox1.List(w)
UserForm11.ListBox1.List(w) = UserForm11.ListBox1.List(z)
UserForm11.ListBox1.List(z) = Temp
UserForm11.Repaint
End If
End If
Next z
Next w
End Sub |
Partager