|
Sub 汇总()
Dim d As Object
Dim ar As Variant, br As Variant
Set d = CreateObject("scripting.dictionary")
Sheets("汇总").[a1].CurrentRegion.Offset(1, 11) = Empty
ar = Sheets("汇总").[a1].CurrentRegion
For i = 2 To UBound(ar)
If Trim(ar(i, 5)) <> "" Then
d(Trim(ar(i, 5))) = i
End If
Next i
For Each sh In Sheets
If sh.Name <> "汇总" Then
br = sh.[a1].CurrentRegion
For i = 2 To UBound(br)
If Trim(br(i, 5)) <> "" Then
n = d(Trim(br(i, 5)))
If n <> "" Then
For j = 12 To UBound(br, 2)
ar(n, j) = ar(n, j) + br(i, j)
Next j
End If
End If
Next i
End If
Next sh
Sheets("汇总").[a1].CurrentRegion = ar
End Sub
|
|