下面来看看代码吧
Sub test()
Dim arr, brr, crr, dic As Object, i, m, n
Set dic = CreateObject("scripting.dictionary")
arr = Range("A1").CurrentRegion.Value '数据赋值到数组
brr = Range("D1").CurrentRegion.Value
For i = 2 To UBound(arr) '装入字典
crr = Split(arr(i, 2), " ")
For m = 0 To UBound(crr)
1) & Split(crr(m), ":")(0)) = Split(crr(m), ":")(1)
Next m
Next i
For m = 2 To UBound(brr) '数据输出
For n = 2 To UBound(brr, 2)
If dic.exists(brr(m, 1) & brr(1, n)) Then
n) = dic(brr(m, 1) & brr(1, n))
End If
Next n
Next m
brr =
End Sub
效果展示:
好了,本期教程就到这里啦,走过路过的点个关注分享一下吧,谢谢啦