|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
参与一下。。。- Sub ykcbf() '//2024.1.21
- Dim arr, d
- Application.ScreenUpdating = False
- Set d = CreateObject("Scripting.Dictionary")
- With Sheets("Sheet1")
- r = .Cells(.Rows.Count, "g").End(xlUp).Row
- arr = .[g5].Resize(r, 3)
- End With
- For i = 2 To UBound(arr)
- m = m + 1
- For j = 1 To UBound(arr, 2)
- s = arr(1, j) & "|" & m
- d(s) = arr(i, j)
- Next
- Next
- m = 0
- With Sheets("Sheet2")
- r = .Cells(.Rows.Count, "d").End(xlUp).Row
- arr = .Range("d5:i" & r)
- .[p6:u1000] = ""
- For i = 2 To UBound(arr)
- m = m + 1
- For j = 1 To UBound(arr, 2)
- s = arr(1, j) & "|" & m
- If d.Exists(s) Then
- arr(i, j) = d(s)
- End If
- Next
- .[p5].Resize(m + 1, UBound(arr, 2)) = arr
- Next
- End With
- Set d = Nothing
- Application.ScreenUpdating = True
- MsgBox "OK!"
- End Sub
复制代码
|
|