arr1 = Sheets("汇总A").UsedRange
Set d1 = CreateObject("scripting.dictionary")
Set d2 = CreateObject("scripting.dictionary")
Set d3 = CreateObject("scripting.dictionary")
Set d4 = CreateObject("scripting.dictionary")
For j = 2 To UBound(arr1)
d1(arr1(j, 7) & arr1(j, 4) & arr1(j, 77)) = d1(arr1(j, 7) & arr1(j, 4) & arr1(j, 77)) + arr1(j, 24)
d2(arr1(j, 7) & arr1(j, 4) & arr1(j, 77)) = d1(arr1(j, 7) & arr1(j, 4) & arr1(j, 77)) + arr1(j, 37)
d3(arr1(j, 7) & arr1(j, 4) & arr1(j, 77) & arr1(j, 2)) = d1(arr1(j, 7) & arr1(j, 4) & arr1(j, 77) & arr1(j, 2)) + arr1(j, 37)
d4(arr1(j, 7) & arr1(j, 4) & arr1(j, 77) & arr1(j, 1)) = d1(arr1(j, 7) & arr1(j, 4) & arr1(j, 77) & arr1(j, 1)) + arr1(j, 37)
Next j
arr2 = Sheets("汇总B").UsedRange
For i = 2 To Sheets("汇总B").Range("a1048576").End(3).Row
arr2(i, 10) = d1(arr2(i, 1) & arr2(i, 7) & arr2(i, 8))
arr2(i, 11) = d2(arr2(i, 1) & arr2(i, 7) & arr2(i, 8))
arr2(i, 12) = d3(arr2(i, 1) & arr2(i, 7) & arr2(i, 8) & arr2(i, 14))
arr2(i, 13) = d4(arr2(i, 1) & arr2(i, 7) & arr2(i, 8) & arr2(i, 14))
Next i
Sheets("汇总B").UsedRange = arr2
这样会出错,并且编号数值过长会乱码,不知道怎么转换
|