|
参与一下。。。
- Sub ykcbf() '//2024.11.11
- Application.ScreenUpdating = False
- Set d = CreateObject("Scripting.Dictionary")
- Set d1 = CreateObject("Scripting.Dictionary")
- a = [{"MTSOL","MTASS","PDB","PDC","PDX","PDD"}]
- b = [{"HQB","ZPB","JJB","ZSB","PDX","PDD"}]
- For x = 1 To UBound(a)
- d(a(x)) = b(x)
- Next
- With Sheets("Picking List")
- r = .Cells(Rows.Count, 1).End(3).Row
- arr = .[a1].Resize(r, 7)
- End With
- ReDim brr(1 To r, 1 To 7)
- For i = 2 To UBound(arr)
- s = arr(i, 6)
- d1(s) = ""
- Next
- Min = Date
- For Each k In d1.keys
- rq = CDate(Replace(k, ".", "/"))
- Min = IIf(Min > rq, rq, Min)
- If rq = Min Then d1.Remove k
- Next
- For i = 2 To UBound(arr)
- For Each k In d1.keys
- If arr(i, 6) = k Then
- m = m + 1
- For j = 1 To UBound(arr, 2)
- brr(m, j) = arr(i, j)
- Next
- st = brr(m, 5)
- s = ston(st)
- If d.exists(s) Then
- brr(m, 7) = d(s)
- Else
- brr(m, 7) = ""
- End If
- End If
- Next
- Next
- With Sheets("结果")
- .UsedRange.Offset(1).ClearContents
- .[a2].Resize(m, 7) = brr
- End With
- Set d = Nothing
- Application.ScreenUpdating = True
- MsgBox "OK!"
- End Sub
复制代码
|
|