|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
学习一下字典
Sub test()
arr = [a3].CurrentRegion
Set d = CreateObject("scripting.dictionary")
For i = 3 To UBound(arr)
If Not d.exists(arr(i, 1)) Then
Set d(arr(i, 1)) = CreateObject("scripting.dictionary")
End If
d(arr(i, 1))(arr(i, 2)) = arr(i, 3)
Next
brr = [e3].CurrentRegion
For i = 3 To UBound(brr)
If d.exists(brr(i, 1)) Then
If d(brr(i, 1)).exists(brr(i, 2)) Then
brr(i, 3) = d(brr(i, 1))(brr(i, 2))
Else
brr(i, 3) = ""
End If
Else
brr(i, 3) = ""
End If
Next
Columns("e").NumberFormat = "@"
[e3].CurrentRegion = brr
End Sub |
评分
-
2
查看全部评分
-
|