Sub s()
Dim sh As Worksheet
With Sheets("总表")
For Each sh In Sheets
If sh.Name <> "总表" Then
n = sh.Cells(Rows.Count, 1).End(3).Row
m = sh.Cells(n, 1).End(3).Row + 1
sh.Range(sh.Cells(m, 1), sh.Cells(n, 5)).Copy .Cells(Rows.Count, 1).End(3).Offset(1)
End If
Next
n = .Cells(Rows.Count, 1).End(3).Row '本行开始排序
m = .Cells(n, 1).End(3).Row + 1
arr = .Range(.Cells(m, 1), .Cells(n, 5))
Do While k < 4 ^ 10
k = 4 ^ 10
For i = 1 To UBound(arr)
If arr(i, 1) < k Then
k = arr(i, 1)
r = i
End If
Next
If k < 4 ^ 10 Then
For i = 1 To 5
.Cells(m, i) = arr(r, i)
Next
m = m + 1
arr(r, 1) = 4 ^ 10
End If
Loop '本行结束排序,删除排序代码即不排序
End With
End Sub来自:求助得到的回答
温馨提示:答案为网友推荐,仅供参考