|
# o* T, ^3 F2 b, t4 I- Sub aa()2 `) R# g8 _ k1 h1 R6 |
- Dim arr- R; c' O' l: V, {% K" O
- Dim d As New Dictionary
5 o) x) a9 o% @ - Dim i As Integer, j As Integer
' c4 a3 W7 M" N+ ~; x - arr = Sheets("字典作列").[A2:F111]
) _3 n! L7 B& h2 W; M - For j = 1 To 5+ Z3 K2 ?! ?5 [0 ^1 @2 e
- Set d(j) = New Dictionary
; t4 C$ F7 o9 b4 Q+ |0 F) {( }/ D - For i = 1 To UBound(arr): m" \ L0 c7 E
- d(j)(arr(i, 1)) = d(j)(arr(i, 1)) + arr(i, j + 1); s8 I6 x/ ]' c+ _9 m+ U
- Next i
. J, n; j( B8 L0 Y* ]2 r/ O5 a - Next j0 y r: c7 Q) ~! u, ?
- Sheets("字典作列").[H2].Resize(d(1).Count) = Application.Transpose(d(1).Keys)# k# Y8 ~, \ e( d* f. t
- For j = 1 To 5- v3 Z3 i( A# O9 O% z' n
- Sheets("字典作列").Cells(2, j + 8).Resize(d(j).Count) = Application.Transpose(d(j).Items)
3 k, O! p, t; H' ^ - Next j/ A4 Y9 y+ ]: p" O1 _
- End Sub! k0 @# R8 v+ X& l: K5 \* ?5 B7 q7 S
复制代码 ; _: k4 O: S" o# C# A: f6 @
|
|