Sub TEST()
Dim xArea As Range, xR As Range, xU As Range, xD, T$
Set xD = CreateObject("Scripting.Dictionary")
Set xArea = Range([B2], [B65536].End(xlUp))
'以BC欄值為KEY納入字典檔並累計次數
For Each xR In xArea
T = xR & xR(1, 2): xD(T) = xD(T) + 1
Next
'檢查符合刪除條件者,納入 xU 儲存格聯集
Set xU = xArea(xArea.Count + 1)
For Each xR In xArea
T = xR & xR(1, 2)
If xD(T) >= 20 And xR(1, 3) = "." Then Set xU = Union(xU, xR)
Next
'刪除
xU.EntireRow.Delete
End Sub作者: kingvincent 時間: 2015-10-25 21:59
Sub TEST()
Dim xArea As Range, xR As Range, xU As Range, xD, T$, i&
For i = 1 To 9 Step 4
Set xD = CreateObject("Scripting.Dictionary")
Set xArea = Range(Cells(2, i), Cells(Rows.Count, i).End(xlUp)(1, 4))
For Each xR In xArea
T = xR(1, 2) & xR(1, 3): xD(T) = xD(T) + 1
Next
Set xU = Cells(xArea.Rows.Count + 2, 1)
For Each xR In xArea
T = xR(1, 2) & xR(1, 3)
If xD(T) >= 20 And xR(1, 4) = "." Then Set xU = Union(xU, xR.Resize(1, 4))
Next
If xU.Count > 1 Then xU.Delete Shift:=xlUp
Next i
End Sub作者: starry1314 時間: 2015-11-27 23:32
Sub TEST()
Dim xArea As Range, xR As Range, xU As Range, xD, T$, i&
For i = 1 To 9 Step 4 '請問這個9的意思是? 知道後面的4是 總共一組四欄來刪除
Set xD = CreateObject("Scripting.Dictionary")
Set xArea = Range(Cells(2, i), Cells(Rows.Count, i).End(xlUp)(1, 4))
For Each xR In xArea
T = xR(1, 2) & xR(1, 3): xD(T) = xD(T) + 1
Next
Set xU = Cells(xArea.Rows.Count + 2, 1)
For Each xR In xArea
T = xR(1, 2) & xR(1, 3)
If xD(T) >= 20 And xR(1, 4) = "." Then Set xU = Union(xU, xR.Resize(1, 4))
Next
If xU.Count > 1 Then xU.Delete Shift:=xlUp
Next i
End Sub作者: starry1314 時間: 2015-11-28 09:40
回復 10#准提部林
目前改為這樣可達成效果,不知是否有不妥的地方
Sub 標籤()
Dim xArea As Range, xR As Range, xU As Range, xD, T$, i&
For i = 1 To 28 Step 9
Set xD = CreateObject("Scripting.Dictionary")
Set xArea = Range(Cells(2, i), Cells(Rows.Count, i).End(xlUp)(1, 8))
For Each xR In xArea
T = xR(1, 5) & xR(1, 6): xD(T) = xD(T) + 1
Next
Set xU = Cells(xArea.Rows.Count + 2, 1)
For Each xR In xArea
T = xR(1, 5) & xR(1, 6)
If xD(T) >= 20 And xR(1, 8) = "." Then Set xU = Union(xU, xR.Resize(1, 9))
Next
If xU.Count > 1 Then xU.Delete Shift:=xlUp
Next i
End Sub作者: 准提部林 時間: 2015-11-28 10:47