|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
参与一下。。。
- Sub ykcbf() '//2023.12.5
- Dim arr, d
- Application.ScreenUpdating = False
- Application.DisplayAlerts = False
- Set d = CreateObject("Scripting.Dictionary")
- With Sheets("正确姓名")
- r = .Cells(.Rows.Count, "a").End(xlUp).Row
- arr = .[a1].Resize(r, 1)
- End With
- For i = 2 To UBound(arr)
- s = arr(i, 1)
- d(s) = ""
- Next
- With Sheets("Sheet2")
- r = .Cells(.Rows.Count, "a").End(xlUp).Row
- arr = .[a1].Resize(r, 1)
- For i = UBound(arr) To 2 Step -1
- s = arr(i, 1)
- If Not d.Exists(s) Then
- .Cells(i, 1).EntireRow.Delete
- End If
- Next
- End With
- Set d = Nothing
- Application.ScreenUpdating = True
- MsgBox "OK!"
- End Sub
复制代码
|
|