|
Sub tt()
Dim d, d1, sht, i, j, ghs, dh, arr, brr, crr, drr, num
Set d = CreateObject("scripting.dictionary")
Set d1 = CreateObject("scripting.dictionary")
Set sht = Sheets("入库数据")
For i = 2 To sht.[a65536].End(3).Row
ghs = sht.Cells(i, 3).Text: dh = sht.Cells(i, 2).Text
d1(ghs & dh) = d1(ghs & dh) + 1
d(ghs) = d(ghs) + sht.Cells(i, "J")
Next
arr = d.keys: brr = d.items: crr = d1.keys: drr = d1.items
For i = 0 To UBound(arr)
Cells(i + 3, "U") = arr(i): Cells(i + 3, "W") = brr(i): num = 0
' For j = 0 To UBound(crr)
' dh = Left(crr(j), Len(arr(i)))
' If dh = arr(i) Then num = num + drr(j)
' Next
' Cells(i + 3, "V") = num
Next
End Sub
中间注释一段调试不通,你的文件连用Left这样的命令都会出现“找不到工程或库”,实在没法编啊。 |
|