|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
Private Sub CommandButton1_Click()
Dim arr, t, i&, j&, k&, m&, n&
arr = Range("e2", Cells(Rows.Count, 1).End(3))
m = UBound(arr): n = UBound(arr, 2)
For i = 1 To UBound(arr)
arr(i, 5) = Val(arr(i, 1) & String(9 - Len(arr(i, 1)), "0"))
Next
ReDim brr(1 To m, 1 To n)
t = Application.Index(arr, 0, 5)
For i = 1 To m
k = Application.Match(Application.Min(t), t, 0)
For j = 1 To n
brr(i, j) = arr(k, j)
Next j
t(k, 1) = ""
Next i
[a2].Resize(UBound(arr), n - 1) = brr
End Sub |
|