Public Sub SortMyArray(ByRef TheArray As Variant)
'If numeric variable type (byte, integer, long, single, double) is passed then the sorting is numeric
'If string variable type is passed then sorting is aphanumeric. Thus 9 is greater than 10!
'Make sure array is "dimensioned" already and array has more than one item
Dim Temp As Variant, X As Long, IsSorted As Boolean
IsSorted = False
Do While Not IsSorted
IsSorted = True
For X = 0 To UBound(TheArray) - 1
If TheArray(X) > TheArray(X + 1) Then
Temp = TheArray(X + 1)
TheArray(X + 1) = TheArray(X)
TheArray(X) = Temp
IsSorted = False
End If
Next X
Loop
End Sub