|
本帖最后由 564951257 于 2015-9-28 16:36 编辑
Sub 查找删除()
Application.ScreenUpdating = False
j = Sheet2.[a65535].End(3).Row
lr = Sheet1.[a65535].End(3).Row
For x = 1 To j
For I = lr To 1 Step -1
Set Rng = sheet1.Range(Cells(1, 1), Cells(lr, 1)).Find(Sheet2.Cells(x, 1), lookat:=xlWhole)
If Not Rng Is Nothing Then
I = Rng.Row
Sheet1.Rows(I).Delete
End If
Next I
Next x
Application.ScreenUpdating = True
End Sub
实际上我一下这样再改是可以的
就是不知道原因是什么
Sub 查找删除()
Application.ScreenUpdating = False
j = Sheet2.[a65535].End(3).Row
lr = Sheet1.[a65535].End(3).Row
sheet1.select
For x = 1 To j
For I = lr To 1 Step -1
Set Rng = Range(Cells(1, 1), Cells(lr, 1)).Find(Sheet2.Cells(x, 1), lookat:=xlWhole)
If Not Rng Is Nothing Then
I = Rng.Row
Sheet1.Rows(I).Delete
End If
Next I
Next x
sheet2.select
Application.ScreenUpdating = True
End Sub
- Sub yy()
- Application.ScreenUpdating = False
- j = Sheet2.[a65535].End(3).Row
- lr = Sheet1.[a65535].End(3).Row
- For x = 1 To j
- Set Rng = Sheet1.Range(Sheet1.Cells(1, 1), Sheet1.Cells(lr, 1)).Find(Sheet2.Cells(x, 1).Value, lookat:=xlWhole)
- If Not Rng Is Nothing Then
- I = Rng.Row
- Sheet1.Rows(I).Delete
- End If
- Next x
- Application.ScreenUpdating = True
- End Sub
复制代码
|
-
-
草稿.zip
9.12 KB, 下载次数: 5
这个是原件附件
|