|
参与一下。。。- Sub ykcbf() '//2024.1.31
- Dim arr, d
- Application.ScreenUpdating = False
- Set d = CreateObject("Scripting.Dictionary")
- With Sheets("应收明细甲")
- r = .Cells(.Rows.Count, "a").End(xlUp).Row
- arr = .[a1].Resize(r, 5)
- End With
- For i = 2 To UBound(arr)
- s = arr(i, 4) & "|" & arr(i, 3) & "|" & arr(i, 1) & "|" & arr(i, 2)
- d(s) = arr(i, 5)
- Next
- With Sheets("测试表")
- r = .Cells(.Rows.Count, "b").End(xlUp).Row
- c = .UsedRange.Columns.Count
- arr = .[a1].Resize(r, c)
- For i = 4 To UBound(arr)
- For j = 10 To UBound(arr, 2)
- s = arr(i, 2) & "|" & arr(i, 3) & "|" & arr(2, j) & "|" & arr(3, j)
- If d.Exists(s) Then
- arr(i, j) = d(s)
- Else
- arr(i, j) = ""
- End If
- Next
- Next
- .[a1].Resize(r, c) = arr
- End With
- Set d = Nothing
- Application.ScreenUpdating = True
- MsgBox "OK!"
- End Sub
复制代码
|
|