- Sub 套路() '//答题专用套路-By瘾大技术差
- Dim i, j, k, arr, brr, crr, Rng As Range, Sht As Worksheet
- Dim d As Object
- Set d = CreateObject("Scripting.Dictionary")
- arr = Sheet1.Range("a2:c" & Sheet1.Cells(Rows.Count, 1).End(xlUp).Row)
- ReDim brr(1 To UBound(arr), 1 To 3)
- For i = 1 To UBound(arr)
- Key = arr(i, 1) & "@@" & arr(i, 2)
- If Not d.exists(Key) Then
- k = k + 1
- d(Key) = k
- brr(k, 1) = arr(i, 1)
- brr(k, 2) = arr(i, 2)
- brr(k, 3) = arr(i, 3)
- Else
- m = d(Key)
- brr(m, 3) = brr(m, 3) + arr(i, 3)
- End If
- Next
- Sheet2.Range("a2:c60000").ClearContents
- Sheet2.Range("a2").Resize(k, 3) = brr
- End Sub
复制代码 |