|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
Option Explicit
Sub TEST6()
Dim ar, i&, j&, dic As Object
Application.ScreenUpdating = False
Set dic = CreateObject("Scripting.Dictionary")
ar = [C1].CurrentRegion.Value
For j = 1 To UBound(ar, 2)
dic(ar(1, j)) = Empty
Next j
ar = Application.Transpose(dic.keys)
bSort ar, 1, UBound(ar), 1, 1, 1
[A1].Resize(UBound(ar)) = ar
Set dic = Nothing
Application.ScreenUpdating = True
Beep
End Sub
Function bSort(ByRef ar, ByVal iFirst&, ByVal iLast&, ByVal iLeft&, _
ByVal iRight&, ByVal iKey&, Optional isOrder As Boolean = True)
Dim i&, j&, k&, vTemp
For i = iFirst To iLast - 1
For j = iFirst To iLast + iFirst - 1 - i
If ar(j, iKey) <> ar(j + 1, iKey) Then
If ar(j, iKey) < ar(j + 1, iKey) Xor isOrder Then
For k = iLeft To iRight
vTemp = ar(j, k)
ar(j, k) = ar(j + 1, k)
ar(j + 1, k) = vTemp
Next
End If
End If
Next j
Next i
End Function
|
评分
-
1
查看全部评分
-
|