1,065
社区成员
发帖
与我相关
我的任务
分享
程序如下:
Sub yy()
Dim Arr, i&, d, Myr&
Set d = CreateObject("Scripting.Dictionary")
[c2:d65535].Clear
Myr = [a65536].End(xlUp).Row
Arr = Range("a1:c" & Myr)
For i = 2 To UBound(Arr)
If Not d.exists(Arr(i, 1)) Then
d(Arr(i, 1)) = Arr(i, 2)
Else
d(Arr(i, 1)) = d(Arr(i, 1)) & "," & Arr(i, 2)
End If
Next
k = d.keys
t = d.items
[c2].Resize(d.Count, 1) = Application.Transpose(k)
[d2].Resize(d.Count, 1) = Application.Transpose(t)
End Sub
合并同类项并用逗号隔开,目前是超过57行以后导致报错,57行以内是正常的,感觉是赋值太小溢出,报错显示在这一行
[d2].Resize(d.Count, 1) = Application.Transpose(t)
麻烦各位帮助解答,十分感谢!!!