求助~~如何把多个工作表自动汇总,剔除重复值
大神们,我想把自建5-9月甚至跟多的工作表自动汇总在一起,重复的项目和经理就自动剔除,对单元格进行删除的时候也能记录留痕的我想学习,最好是能教我使用的是VBA还是函数公式,拜托了!!!
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 感谢感谢,我去试试
页:
[1]