|
代码以附件为准。- Sub ykcbf() '//2024.2.23
- Dim arr, d
- Application.ScreenUpdating = False
- Set d = CreateObject("Scripting.Dictionary")
- Set ws = ThisWorkbook
- Set Sh = ws.Sheets("查找")
- With Sh
- arr = .[o1:v2].Value
- For Each k In arr
- If k <> Empty Then
- s = CStr(k)
- d(s) = ""
- End If
- Next
- End With
- With Sheets("明细表")
- r = .Cells(.Rows.Count, "a").End(xlUp).Row
- c = .UsedRange.Columns.Count
- arr = .[a1].Resize(r, c)
- End With
- ReDim brr(1 To UBound(arr), 1 To 9)
- For i = 2 To UBound(arr)
- s = CStr(arr(i, 10))
- If d.exists(s) Then
- m = m + 1
- For j = 2 To c - 1
- brr(m, j - 1) = arr(i, j)
- Next
- End If
- Next
- With Sh
- .[n5:v10000] = ""
- .Columns("V:V").NumberFormatLocal = "@"
- .[n5].Resize(m, 9) = brr
- End With
- Set d = Nothing
- Application.ScreenUpdating = True
- MsgBox "OK!"
- End Sub
复制代码
|
|