|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
- Sub test()
- arr = Sheets("原表").Range("A1").CurrentRegion
- brr = Sheets("数据").Range("A1").CurrentRegion
- Dim crr(1 To 10000, 1 To 1)
- Set d = CreateObject("Scripting.Dictionary")
- For i = 2 To UBound(brr)
- d(brr(i, 1)) = brr(i, 2)
- Next
- k1 = d.keys
- t1 = d.items
- For j = 2 To UBound(arr)
- mystr = Replace(arr(j, 2), "、", "+")
- For k = 0 To d.Count - 1
- If InStr(mystr, k1(k)) Then
- mystr = Replace(mystr, k1(k), t1(k))
- End If
- Next
- crr(j - 1, 1) = Evaluate("=" & mystr)
- Next
- [C2].Resize(UBound(crr), 1) = crr
- Set d = Nothing
- End Sub
复制代码 |
|