下面
- 副本行8從你的所有9張(如果該名稱存在的話)向下代碼片被稱爲「安裝」
- 任何記錄小於60%的autofiltered和從主片(不是複製之前自動篩選各9片的更有效)
刪除個
- 空白行頂部添加啓動「安裝」在第8行
*如果您確實需要從第1行頭行7,那麼這些可以從業務員片之一被複制 - 讓我知道*
Sub QuickCombine()
Dim ws1 As Worksheet
Dim ws2 As Worksheet
Dim rng1 As Range
Dim strShts()
Dim strWs As Variant
Dim lngCalc As Long
With Application
.ScreenUpdating = False
lngCalc = .Calculation
.Calculation = xlCalculationManual
End With
Set ws1 = Sheets("Install")
ws1.UsedRange.Cells.Clear
strShts = Array("Jeff", "John", "Tim", "Pete", "Chad", "Bob", "Kevin", "Mike", "Bill")
For Each strWs In strShts
On Error Resume Next
Set ws2 = Sheets(strWs)
On Error GoTo 0
If Not ws2 Is Nothing Then
Set rng1 = ws2.Range(ws2.[v8], ws2.Cells(Rows.Count, "v").End(xlUp))
rng1.EntireRow.Copy ws1.Cells(ws1.Cells(Rows.Count, "v").End(xlUp).Offset(1, 0).Row, "A")
End If
Set ws2 = Nothing
Next
With ws1
.[v1] = "dummy"
.Columns("V").AutoFilter Field:=1, Criteria1:="<60%"
.Rows.Delete
.Rows("1:7").Insert
End With
With Application
.ScreenUpdating = True
.Calculation = lngCalc
End With
End Sub
+ 1對於自動篩選!它比循環:) –
我只是有一個想法一個更快的方法,這將令人難以置信的工作,如果所有工作表的總排在一起不超過Excel的行限制。替代方案也可以是將每個工作表中已過濾的行復制到主工作表。就像我提到的,它僅僅是一個想法... :) –
@SiddharthRout好點,而這是不可能的1M的行會被編譯9張是值得研究的超過 - 我會更新 – brettdj