VB Code:
Public Sub SortByLength(lst As ListBox)
'=======================================
Dim i&, j&, tmpValue
Dim arTemp() As String
Debug.Print "Start Time: " & Format(Now, "hh:nn:ss")
ReDim arTemp(lst.ListCount - 1)
For i = 0 To lst.ListCount - 1
arTemp(i) = lst.List(i)
Next i
lst.Clear
For i = 0 To UBound(arTemp)
For j = i To UBound(arTemp)
If Len(arTemp(i)) > Len(arTemp(j)) Then
tmpValue = arTemp(j)
arTemp(j) = arTemp(i)
arTemp(i) = tmpValue
End If
Next
lst.AddItem arTemp(i)
Next
Debug.Print "End Time: " & Format(Now, "hh:nn:ss")
End Sub