|
Option Explicit
Sub summary()
Dim ws As Worksheet, mydic As Object, i As Long, arr1(), arr2(), arr3()
Set mydic = CreateObject("scripting.dictionary")
For Each ws In Worksheets
If ws.Name <> "汇总" Then
For i = 3 To ws.Cells(Rows.CountLarge, 2).End(xlUp).Row
mydic(ws.Cells(i, 2).Value & "-" & ws.Cells(i, 3).Value) = ""
Next i
End If
Next ws
arr1() = mydic.keys: arr2() = mydic.keys: arr3() = mydic.keys
For i = 0 To mydic.Count - 1
arr2(i) = Split(arr1(i), "-")(0)
arr3(i) = Split(arr1(i), "-")(1)
Next i
Worksheets("汇总").Range("B3").Resize(mydic.Count, 1) = Application.Transpose(arr2())
Worksheets("汇总").Range("C3").Resize(mydic.Count, 1) = Application.Transpose(arr3())
End Sub |
|