問題描述:彙總多個工做表的指定字段到sheet1裏面,並去除重複的字段內容。spa
Sub 去重彙總()3d
Dim sht As Worksheet, j As Integer, x As Integerblog
Set d = CreateObject("scripting.dictionary")ip
For Each sht In Worksheetsio
If sht.Name <> ActiveSheet.Name Thenim
j = sht.Range("a65536").End(xlUp).Rowdb
arr = sht.Range("a3:a" & j)dict
For x = 1 To UBound(arr)img
d(arr(x, 1)) = ""di
Next
End If
Next
k = d.keys
ActiveSheet.Range("a2").Resize(d.Count, 1) = Application.Transpose(k)
End Sub
效果圖: