1: If rngNew.Find(.Cells(i, 2), after:=wsh2.Cells(j, 1)) Is Nothing Then
.Cells(i, 2).Offset(0).EntireRow.Delete
'舊維修單刪除一行後,行數少1
row1 = row1 - 1
'新維修單少比對一行,以增加程式效率
j = j + 1
row2 = row2 - 1
'改善刪除一行後,程式改從下一行開始比對
GoTo 1
End If
Next
End With
End Sub
複製代碼
作者: 准提部林 時間: 2016-8-29 16:47
Sub 刪除_01()
Dim R&, i&
Application.ScreenUpdating = False
With Sheets("未完工維修單")
R = .[B65536].End(xlUp).Row
For i = R To 2 Step -1
If Sheets("list_toexcel").[A:A].Find(.Cells(i, 2), Lookat:=xlWhole) Is Nothing Then
.Cells(i, 2).EntireRow.Delete
End If
Next
End With
End Sub