- Sub 统计()
- Dim d, ar, br(), m%
- Set d = CreateObject("Scripting.Dictionary")
- [A12:K24] = Empty
- sa = Array(4, 5, 1, 3, 2, 6, 7, 8, 9)
- ar = Sheet2.Range("A1").CurrentRegion
- For i = 2 To UBound(ar)
- s = ar(i, 1) & ar(i, 2)
- If d(s) = "" Then
- m = m + 1
- ReDim Preserve br(1 To 11, 1 To m)
- d(s) = m
- For j = 0 To 8
- br(j + 1, m) = ar(i, sa(j))
- Next
- Else
- br(6, d(s)) = br(6, d(s)) + ar(i, 6)
- br(9, d(s)) = br(9, d(s)) + ar(i, 9)
- End If
- Next
- [A12].Resize(m, 11) = Application.Transpose(br)
- Set d = Nothing
- End Sub
复制代码 |