|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
参与一下。。。
- Sub ykcbf() '//2024.11.27
- Application.ScreenUpdating = False
- Set d = CreateObject("Scripting.Dictionary")
- With Sheets("未到货台账")
- r = .Cells(Rows.Count, 1).End(3).Row
- arr = .[a1].Resize(r, 15)
- End With
- For i = 3 To UBound(arr)
- s = arr(i, 2) & "|" & arr(i, 4)
- If Val(arr(i, 1)) Then
- If Not d.exists(s) Then
- d(s) = Array(arr(i, 7), arr(i, 11), arr(i, 15))
- Else
- t = d(s)
- t(0) = IIf(InStr(t(0), arr(i, 7)), t(0), t(0) & "/" & arr(i, 7))
- t(1) = IIf(InStr(t(1), arr(i, 11)), t(1), t(1) & "/" & arr(i, 11))
- t(2) = IIf(InStr(t(2), arr(i, 15)), t(2), t(2) & "/" & arr(i, 15))
- d(s) = t
- End If
- End If
- Next
- With Sheets("明细数据汇总")
- r = .Cells(Rows.Count, 1).End(3).Row
- c = .Cells(3, Columns.Count).End(1).Column
- arr = .[a1].Resize(r, c)
- For j = 6 To UBound(arr, 2) Step 3
- For i = 4 To UBound(arr)
- s = arr(2, j) & "|" & arr(i, 4)
- If d.exists(s) Then
- arr(i, j) = d(s)(0)
- arr(i, j + 1) = d(s)(1)
- arr(i, j + 2) = d(s)(2)
- Else
- arr(i, j) = "已满箱"
- arr(i, j + 1) = ""
- arr(i, j + 2) = ""
- End If
- Next
- Next
- .[a1].Resize(r, c) = arr
- End With
- Set d = Nothing
- Application.ScreenUpdating = True
- MsgBox "OK!"
- End Sub
复制代码
|
评分
-
1
查看全部评分
-
|