|
参与一下。。。
- Sub ykcbf() '//2024.3.29
- Application.ScreenUpdating = False
- Set d = CreateObject("Scripting.Dictionary")
- Set d1 = CreateObject("Scripting.Dictionary")
- With Sheets("数据源")
- r = .Cells(Rows.Count, 1).End(3).Row
- arr = .[a1].Resize(r, 5)
- End With
- For i = 2 To UBound(arr)
- s1 = arr(i, 4)
- d1(s1) = ""
- s = arr(i, 5) & "|" & CStr(arr(i, 1)) & "|" & CDate(arr(i, 4))
- d(s) = arr(i, 3)
- Next
- ReDim brr(1 To d.Count, 1 To 3)
- For Each k In d.keys
- m = m + 1
- brr(m, 1) = Split(k, "|")(0)
- brr(m, 3) = Split(k, "|")(1)
- Next
- t = d1.keys
- sort1 t, True
- With Sheets("库存批次数据")
- .UsedRange.Offset(1, 7).ClearContents
- .Cells(3, 8).Resize(1, d1.Count) = t
- .Columns(3).NumberFormatLocal = "@"
- .[a4].Resize(m, 3) = brr
- arr = .UsedRange
- For i = 2 To UBound(arr)
- For j = 8 To UBound(arr, 2)
- s = arr(i, 1) & "|" & CStr(arr(i, 3)) & "|" & CDate(arr(1, j))
- If d.exists(s) Then
- arr(i, j) = d(s)
- End If
- Next
- Next
- .UsedRange = arr
- End With
- Set d = Nothing
- Application.ScreenUpdating = True
- MsgBox "OK!"
- End Sub
复制代码
|
评分
-
1
查看全部评分
-
|