|
Option Explicit
Sub TEST1()
Dim ar(), i&, r&, wks As Worksheet
For i = 2 To Worksheets.Count
r = r + 1
ReDim Preserve ar(1 To r)
ar(r) = Worksheets(i).Name
Next i
bSort1 ar, 1, UBound(ar), False
For i = 1 To UBound(ar)
Worksheets(ar(i)).Move after:=Worksheets(1)
Next i
Beep
End Sub
Function bSort1(ar, iFirst&, iLast&, Optional isOrder As Boolean = True)
Dim i&, j&, vTemp
For i = iFirst To iLast - 1
For j = iFirst To iLast + iFirst - 1 - i
If ar(j) <> ar(j + 1) Then
If ar(j) < ar(j + 1) Xor isOrder Then
vTemp = ar(j): ar(j) = ar(j + 1): ar(j + 1) = vTemp
End If
End If
Next j
Next i
End Function |
评分
-
1
查看全部评分
-
|