|
- Sub test()
- Dim Dic, I&, J&, K&, Ar, Sht As Worksheet, Br
- Set Dic = CreateObject("scripting.dictionary")
- ' Ar = Range("a1").CurrentRegion
- ' For I = 3 To UBound(Ar)
- ' Dic(Ar(I, 2) & Ar(I, 3)) = 0
- ' Next
- For Each Sht In Worksheets
- If Sht.Name <> "汇总" Then
- Br = Sht.Range("a1").CurrentRegion
- For I = 3 To UBound(Br)
- Dic(Br(I, 2) & Br(I, 3)) = Br(I, 5) + Dic(Br(I, 2) & Br(I, 3))
- Next
- Erase Br
- End If
- Next
- Ar = Sheets("汇总").Range("a1").CurrentRegion
- For I = 3 To UBound(Ar)
- Range("e" & I) = Dic(Ar(I, 2) & Ar(I, 3))
- Next
- End Sub
复制代码 |
|