|

楼主 |
发表于 2017-2-10 16:14
|
显示全部楼层
Sub 自动查询_条目数组用法()
Dim d As Object
Dim arr As Variant
Dim i As Integer
Dim j As Integer
Dim rng As Range
Set d = CreateObject("scripting.dictionary")
With Sheets("data")
arr = .Range("a2:e" & .Cells(Rows.Count, 1).End(xlUp).Row)
End With
For i = 1 To UBound(arr)
d(arr(i, 1)) = Array(arr(i, 2), arr(i, 3), arr(i, 4), arr(i, 5))
j = d(arr(i, 1))
Next
For Each rng In Range("a3:a" & Cells(Rows.Count, 1).End(xlUp).Row)
rng.Offset(0, 1).Resize(1, 4) = d(rng.Value)
Next
End Sub |
|