|
楼主 |
发表于 2017-1-28 11:35
|
显示全部楼层
好多人做过这条 发答案学其他学习
yayahzmeng
Sub mysub()
Dim start As Double
start = Timer
'在这里添加你的代码
Application.ScreenUpdating = False
Dim arr, i%, j%, sname
Dim sh As Worksheet, maxr
sname = ActiveSheet.Name
Range("B3:F" & [B65536].End(4).Row).ClearContents
j = 3
For Each sh In Sheets
If sh.Name <> sname Then
maxr = sh.[B65536].End(3).Row
arr = sh.Range("B3:L" & maxr)
For i = 1 To maxr - 2
Sheets(sname).Cells(j, 2) = arr(i, 1)
Sheets(sname).Cells(j, 3) = arr(i, 2)
Sheets(sname).Cells(j, 4) = arr(i, 5)
Sheets(sname).Cells(j, 5) = arr(i, 11)
Sheets(sname).Cells(j, 6) = arr(i, 10)
j = j + 1
Next
Erase arr
End If
Next
Application.ScreenUpdating = True
MsgBox "程序共执行了" & Format(Timer - start, "0.000") & "秒!"
End Sub
yayahzmeng
Sub mysub()
Dim start As Double
start = Timer
'在这里添加你的代码
Application.ScreenUpdating = False
Dim i%, j%, z%, k%, maxr%, sname$, T$
Dim sh As Worksheet
sname = ActiveSheet.Name
Range("B3:F" & [B65536].End(4).Row).ClearContents
j = 3
For Each sh In Sheets
If sh.Name <> sname Then
maxr = sh.[B65536].End(3).Row
For i = 3 To maxr
For z = 2 To 6
T = Sheets(sname).Cells(2, z)
k = sh.Range("B2:L2").Find(T).Column
Cells(j, z) = sh.Cells(i, k)
Next
j = j + 1
Next
End If
Next
Application.ScreenUpdating = True
MsgBox "程序共执行了" & Format(Timer - start, "0.000") & "秒!"
End Sub
|
|