|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
学习一下字典,打扰了
Sub test()
arr = [a1].CurrentRegion
Set d = CreateObject("scripting.dictionary")
ReDim brr(1 To UBound(arr), 1 To 2)
For i = 1 To UBound(arr)
If Not d.exists(arr(i, 1)) Then
Set d(arr(i, 1)) = CreateObject("scripting.dictionary")
End If
d(arr(i, 1))(arr(i, 2)) = ""
Next
m = 1
For Each kk In d.keys
brr(m, 1) = kk
For Each kk1 In d(kk).keys
brr(m, 2) = kk1
m = m + 1
Next
Next
[h1].Resize(UBound(brr), UBound(brr, 2)) = brr
End Sub |
评分
-
1
查看全部评分
-
|