|
Sub zz()
Dim d, ar, br, sh As Worksheet, a, b
Set d = CreateObject("Scripting.Dictionary")
br = Sheet1.[b2:ai127]
For Each sh In Sheets
If sh.Name <> "总表" Then
ar = sh.Range("B1").CurrentRegion
For i = 4 To UBound(ar) - 1
If ar(i, 1) <> "" Then a = ar(i, 1)
For j = 3 To UBound(ar, 2) - 1
If ar(2, j) <> "" Then b = ar(2, j)
d(a & ar(i, 2) & b & ar(3, j)) = d(a & ar(i, 2) & b & ar(3, j)) + ar(i, j)
Next
Next
End If
Next
For i = 3 To UBound(br)
If br(i, 1) <> "" Then a = br(i, 1)
For j = 3 To UBound(br, 2)
If br(1, j) <> "" Then b = br(1, j)
br(i, j) = d(a & br(i, 2) & b & br(2, j))
Next
Next
Sheet1.[b2:ai127] = br
End Sub
|
|