|
楼主 |
发表于 2022-12-1 09:47
|
显示全部楼层
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
Sub test()
Dim i, j, arr
Set d = CreateObject("scripting.dictionary")
arr = Range("a1").CurrentRegion
For i = 2 To UBound(arr)
For j = 4 To UBound(arr, 2)
If Not d.exists(arr(i, 1)) Then
Set d(arr(i, 1)) = CreateObject("scripting.dictionary")
If Not d(arr(i, 1)).exists(arr(i, 2)) Then
Set d(arr(i, 1))(arr(i, 2)) = CreateObject("scripting.dictionary")
d(arr(i, 1))(arr(i, 2))(arr(1, j)) = arr(i, j)
End If
End If
Next
Next
Range("d9") = d([a9].Value)([b9].Value)([c9].Value)
End Sub
|
|