Dim I As Long, temp, Ok As Boolean
Private Sub UserForm_Initialize()
ListBox1.List = Range("A2", Range("B" & Rows.Count).End(3)).Value
End Sub
Private Sub CommandButton1_Click() 'Tri de A à Z
With ListBox1
Do
Ok = True
For I = 0 To .ListCount - 2
If .List(I) > .List(I + 1) Then
For j = 0 To 1
temp = .List(I, j)
.List(I, j) = .List(I + 1, j)
.List(I + 1, j) = temp
Ok = False
Next j
End If
Next I
Loop Until Ok = True
End With
End Sub
Private Sub CommandButton2_Click() 'Tri de Z à A
With ListBox1
Do
Ok = True
For I = 0 To .ListCount - 2
If .List(I) < .List(I + 1) Then
For j = 0 To 1
temp = .List(I, j)
.List(I, j) = .List(I + 1, j)
.List(I + 1, j) = temp
Ok = False
Next j
End If
Next I
Loop Until Ok = True
End With
End Sub