|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
参与一下。。。
- Sub ykcbf() '//2024.7.29
- Application.ScreenUpdating = False
- Set d = CreateObject("Scripting.Dictionary")
- With Sheets("出库查询")
- r = .Cells(Rows.Count, 3).End(3).Row
- zrr = .[a1].Resize(r, 7)
- For i = 3 To UBound(zrr)
- s = zrr(i, 2)
- d(s) = i
- Next
- End With
- With Sheets("扫码区")
- r = .Cells(Rows.Count, 1).End(3).Row
- arr = .[a1].Resize(r, 3)
- For i = 2 To UBound(arr)
- s = arr(i, 1)
- If d.exists(s) Then
- arr(i, 2) = zrr(d(s), 3)
- arr(i, 3) = zrr(d(s), 4)
- End If
- Next
- .[a1].Resize(r, 3) = arr
- End With
- Set d = Nothing
- Application.ScreenUpdating = False
- MsgBox "OK!"
- End Sub
复制代码
|
|