VBA数据字典求助
展开全部
参考下面的代码,是数据指点的应用:
Sub Macro1()
Dim arr, brr, d, i&, j%, k%, s&
Set d = CreateObject("scripting.dictionary")
arr = Sheets("数据源").Range("a1").CurrentRegion
ReDim brr(1 To UBound(arr), 1 To UBound(arr, 2))
For i = 1 To UBound(arr)
p = ""
For j = 1 To UBound(arr, 2)
p = p & "," & arr(i, j)
Next
If Not d.exists(p) Then
s = s + 1
d(p) = ""
For k = 1 To UBound(arr, 2)
brr(s, k) = arr(i, k)
Next
End If
Next
Sheets("主表").Range("a1").Resize(s, UBound(brr, 2)) = brr
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询