|
楼主 |
发表于 2015-6-18 14:18
|
显示全部楼层
程序法分类汇总:
- Sub 按钮1_Click()
- Dim dic As Object
- Dim i As Integer, a As Integer, j As Integer
- Dim k As Variant
- Dim t As Variant
- Set dic = CreateObject("scripting.dictionary")
- Application.ScreenUpdating = False
- Range("J2:M100").ClearContents
- arr = Range("C2:F" & [C65536].End(xlUp).Row)
- For i = 1 To UBound(arr)
- dic(arr(i, 1) & "|" & arr(i, 2) & "|" & arr(i, 3)) = dic(arr(i, 1) & "|" & arr(i, 2) & "|" & arr(i, 3)) + arr(i, 4)
- Next i
- k = dic.keys
- t = dic.items
- ReDim brr(1 To 3, 1 To dic.Count)
- For a = 1 To 3
- For j = 1 To dic.Count
- brr(a, j) = Split(k(j - 1), "|")(a - 1)
- Next j
- Next a
- Range("j2").Resize(dic.Count, 3) = Application.WorksheetFunction.Transpose(brr)
- Range("m2").Resize(dic.Count, 1) = Application.WorksheetFunction.Transpose(t)
- Application.ScreenUpdating = True
- End Sub
复制代码
|
|