For w = 0 To UBound(ar)
s(w) = ""
For k = 1 To Len(ar(w))
s(w) = s(w) & Right("0000" & AscW(Mid(ar(w), k, 1)), 4)
Next
If Len(s(w)) > m Then m = Len(s(w))
Next
For w = 0 To UBound(ar)
s(w) = Right(Space(m) & s(w), m)
Next
For i = 0 To UBound(ar)
For j = 0 To UBound(ar) - 1
If (s(j)) > (s(j + 1)) Then
temp = s(j)
s(j) = s(j + 1)
s(j + 1) = temp
temp = ar(j)
ar(j) = ar(j + 1)
ar(j + 1) = temp
End If
Next j
Next i
MsgBox Join(ar, vbCrLf)
End Sub作者: bobomi 時間: 2015-1-15 13:43
改成這各囉
Sub XX()
ar = Array("a1", "b1", "a3", "ab1", "aa3", "aa1", "aa0")
For w = 0 To UBound(ar)
If Len(ar(w)) > m Then m = Len(ar(w))
Next
For w = 0 To UBound(ar)
ar(w) = Right(Space(m) & ar(w), m)
Next
For i = 0 To UBound(ar)
For j = 0 To UBound(ar) - 1
If (ar(j)) > (ar(j + 1)) Then
temp = ar(j)
ar(j) = ar(j + 1)
ar(j + 1) = temp
End If
Next j
Next i
For w = 0 To UBound(ar)
ar(w) = LTrim(ar(w))
Next