|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
本帖最后由 fzxba 于 2024-3-12 15:23 编辑
明白了,没搞清楚,不好意思再来,楼下老师继续……
补,还是改一下吧:
Sub test1()
Dim result()
Dim ar, br, cr, Dict As Object
Dim i As Long, j As Long, k As Long, p As Long
Set Dict = CreateObject("Scripting.Dictionary")
ar = Range("Q1", Range("Q1").End(xlDown))
ReDim result(1 To UBound(ar), 1 To 80)
For i = 2 To UBound(ar)
br = Split(Trim(ar(i, 1)), ";")
For j = 0 To UBound(br)
If Len(br(j)) Then
cr = Split(br(j), ":")
If Not Dict.Exists(cr(0)) Then
k = k + 1
Dict.Add cr(0), k
result(1, k) = cr(0)
End If
result(i, Dict(cr(0))) = Val(cr(UBound(cr)))
End If
Next
Next
Range("R1").Resize(UBound(result), k) = result
Set Dict = Nothing
Beep
End Sub
|
评分
-
1
查看全部评分
-
|