|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
- Sub cao()
- Dim arr, brr, crr, d,i%
- arr = Sheet2.[a1].CurrentRegion: brr = Sheet3.[a1].CurrentRegion
- ReDim crr(1 To UBound(arr) + UBound(brr) - 2, 1 To 2)
- For i = 2 To UBound(arr)
- crr(i - 1, 1) = arr(i, 1)
- crr(i - 1, 2) = arr(i, 3) & "|" & arr(i, 4) & "|" & arr(i, 10)
- Next
- For i = 2 To UBound(brr)
- crr(UBound(arr) + i - 2, 1) = brr(i, 1)
- crr(UBound(arr) + i - 2, 2) = brr(i, 11) & "|" & brr(i, 3) & "|" & brr(i, 6)
- Next
- Set d = CreateObject("Scripting.Dictionary")
- For i = 1 To UBound(crr)
- d(crr(i, 1)) = crr(i, 2)
- Next
- With Sheet1
- arr = .Range("b2:e" & .Cells(Rows.Count, 2).End(xlUp).Row)
- For i = 1 To UBound(arr)
- arr(i, 2) = Val(Split(d(arr(i, 1)), "|")(0))
- arr(i, 3) = Val(Split(d(arr(i, 1)), "|")(1))
- arr(i, 4) = Val(Split(d(arr(i, 1)), "|")(2))
- Next
- [b2].Resize(UBound(arr, 1), UBound(arr, 2)) = arr
- End With
- End Sub
复制代码 |
评分
-
1
查看全部评分
-
|