|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
结果写到D列了。。。
Sub 按钮1_Click()
Dim a, b()
a = Range("A2:A" & [a65536].End(3).Row)
ReDim b(1 To UBound(a), 1 To 1)
For i = 1 To UBound(a)
Dim d
Set d = CreateObject("Scripting.Dictionary")
For j = 0 To UBound(Split(a(i, 1), ","))
If Not d.exists(Val(Split(a(i, 1), ",")(j))) Then d.Add Val(Split(a(i, 1), ",")(j)), ""
Next j
Dim c
c = d.Count
Do While c > 0
If b(i, 1) = "" Then
b(i, 1) = WorksheetFunction.Min(d.keys())
Else
b(i, 1) = b(i, 1) & "," & WorksheetFunction.Min(d.keys())
End If
d.Remove WorksheetFunction.Min(d.keys())
c = d.Count
Loop
Next i
[d2].Resize(UBound(b), 1) = b
End Sub |
评分
-
1
查看全部评分
-
|