第28集 VBA字典二
123、 提取不重复的值
Sub 提取不重复的产品()
Dim d As New Dictionary
Dim arr, x
arr = Range(“a2:a12”)
For x = 1 To UBound(arr)
d(arr(x, 1)) = “” ‘利用字典key列不重复特点,装入不重复的key值,item列全设置为空
Next x
Range(“c2”).Resize(d.Count) = Application.Transpose(d.Keys)
End Sub
124、 多行2列分类汇总
Sub 汇总()
Dim d As New Dictionar