|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
Sub dddd()
Dim d As Object, arr, arr1(), i%, n%, m%
Set d = CreateObject("scripting.dictionary")
arr = Sheets("欠料明细").Range("a2:c" & Sheets("欠料明细").Cells(Rows.Count, 1).End(xlUp).Row)
Range("a:b").ClearContents
[a1] = "订单单号": [b1] = "欠料汇总"
For i = 1 To UBound(arr)
If arr(i, 3) < 0 Then
If Not d.exists(arr(i, 1)) Then
n = n + 1
d(arr(i, 1)) = n
ReDim Preserve arr1(1 To 2, 1 To n)
arr1(1, n) = arr(i, 1)
arr1(2, n) = arr(i, 2)
Else
m = d(arr(i, 1))
arr1(2, m) = Join(Array(arr1(2, m), arr(i, 2)), "、")
End If
End If
Next
Cells(2, 1).Resize(n, 2) = Application.Transpose(arr1)
End Sub
|
评分
-
1
查看全部评分
-
|