|
楼主 |
发表于 2024-2-5 10:48
|
显示全部楼层
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
抄写如下
- Sub 模式一()
- Set d = CreateObject("Scripting.Dictionary")
- arr = Sheets("查询表").[a1].CurrentRegion
- For i = 2 To UBound(arr)
- For j = 2 To UBound(arr, 2)
- If arr(i, j) <> " " Then d(arr(i, 1)) = arr(i, j)
- Next
- Next
- arr = Sheets("替换模式一").[a1].CurrentRegion
- For i = 2 To UBound(arr)
- arr(i, 3) = d(arr(i, 1))
- Next
- Sheets("替换模式一").[a1].CurrentRegion = arr
- End Sub
- Sub 模式二()
- Set d = CreateObject("Scripting.Dictionary")
- arr = Sheets("查询表").[a1].CurrentRegion
- For i = 2 To UBound(arr)
- For j = 2 To UBound(arr, 2)
- d(arr(i, j)) = arr(i, 1)
- Next
- Next
- arr = Sheets("替换模式二").[a1].CurrentRegion
- For i = 2 To UBound(arr)
- arr(i, 3) = d(arr(i, 1))
- Next
- Sheets("替换模式二").[a1].CurrentRegion = arr
- End Sub
复制代码
|
|