|
- Sub qs() '2024/10/19
- Dim arr, i, dic
- Set dic = CreateObject("scripting.dictionary")
- With Sheet2
- arr = .Range("f8:l" & .Cells(Rows.Count, "g").End(3).Row)
- For i = 1 To UBound(arr)
- s = arr(i, 1) & arr(i, 2) & arr(i, 3) & arr(i, 4) & arr(i, 5)
- If Not dic.exists(s) Then
- dic(s) = Application.Transpose(Application.Transpose(Application.Index(arr, i, 0)))
- Else
- a = dic(s)
- a(6) = a(6) + arr(i, 6)
- a(7) = a(7) + arr(i, 7)
- dic(s) = a
- End If
- Next
- .Range("P8").Resize(60000, 7) = ""
- .Range("P8").Resize(dic.Count, UBound(arr, 2)) = Application.Rept(dic.items, 1)
- End With
- Set dic = Nothing
- End Sub
复制代码 |
|