Sub fjsgfh()
Dim i, ir, m, arr, brr(), tt
Dim dc As Object
Set dc = CreateObject("scripting.dictionary")
tt = Timer
ir = Range("a1").End(xlDown).Row
arr = Range("a2:l" & ir + 1)
For i = 1 To ir - 1
If arr(i, 3) = arr(i + 1, 3) Then
If dc.exists(arr(i, 3)) = False Then
dc(arr(i, 3)) = ""
m = m + 1
ReDim Preserve brr(1 To 11, 1 To m)
brr(1, m) = arr(i, 1) & arr(i, 2)
brr(2, m) = arr(i, 3)
brr(3, m) = arr(i, 4)
brr(4, m) = arr(i, 5)
brr(5, m) = arr(i, 6)
brr(6, m) = arr(i, 7)
brr(7, m) = arr(i, 8)
brr(8, m) = arr(i, 9)
Else
brr(7, m) = brr(7, m) + arr(i, 8)
brr(8, m) = brr(8, m) + arr(i, 9)
End If
Else
If dc.exists(arr(i, 3)) = False Then
m = m + 1
ReDim Preserve brr(1 To 11, 1 To m)
brr(1, m) = arr(i, 1) & arr(i, 2) & "-" & arr(i, 1) & arr(i, 2)
brr(2, m) = arr(i, 3)
brr(3, m) = arr(i, 4)
brr(4, m) = arr(i, 5)
brr(5, m) = arr(i, 6)
brr(6, m) = arr(i, 7)
brr(7, m) = arr(i, 8)
brr(8, m) = arr(i, 9)
brr(9, m) = arr(i, 10)
brr(10, m) = arr(i, 11)
brr(11, m) = arr(i, 12)
Else
brr(1, m) = brr(1, m) & "-" & arr(i, 1) & arr(i, 2)
brr(7, m) = brr(7, m) + arr(i, 8)
brr(8, m) = brr(8, m) + arr(i, 9)
brr(9, m) = arr(i, 10)
brr(10, m) = arr(i, 11)
brr(11, m) = arr(i, 12)
End If
End If
Next
ir = Sheet1.Range("a100000").End(xlUp).Row
If ir > 2 Then
Sheet1.Range("a2:k" & ir).ClearContents
End If
Sheet1.Range("a2").Resize(m, 11) = Application.WorksheetFunction.Transpose(brr)
MsgBox ("统计完成用时:" & Timer - tt & "秒")
Set dc = Nothing
End Sub |