|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
是不是要这样?
Sub test()
Dim Arr, mRow&, i&, j&, k&, L&, tmPkey%
Arr = [a2].Resize([a1].CurrentRegion.Rows.Count - 1, [a1].CurrentRegion.Columns.Count)
tmPkey = 2
For j = 1 To UBound(Arr, 2) Step 3
For i = 1 To UBound(Arr, 1) - 1
For k = i + 1 To UBound(Arr, 1)
If Arr(k, j - 1 + tmPkey) > Arr(i, j - 1 + tmPkey) Then
For L = 1 To 3
tmp = Arr(i, j + L - 1): Arr(i, j + L - 1) = Arr(k, j + L - 1): Arr(k, j + L - 1) = tmp
Next L
End If
Next k
Next i
Next j
[L2].Resize(UBound(Arr, 1), UBound(Arr, 2)) = Arr
End Sub |
评分
-
1
查看全部评分
-
|