|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
- Sub sx()
- Dim j&
- Set d = CreateObject("scripting.dictionary")
- arr1 = Sheet3.Cells(1, 1).CurrentRegion.Value2: For i = 2 To UBound(arr1): d("a " & arr1(i, 1)) = i: Next
- arr2 = Sheet4.Cells(1, 1).CurrentRegion.Value2: For i = 2 To UBound(arr2): d("b " & arr2(i, 1)) = i: Next
- arr3 = Sheet5.Cells(1, 1).CurrentRegion.Value2: For i = 2 To UBound(arr3): d("c " & arr3(i, 1)) = i: Next
- arr = Cells(1, 1).CurrentRegion.Value2
- For i = 3 To UBound(arr)
- j = d("a " & arr(i, 7)): If j Then arr(i, 1) = arr1(j, 3): arr(i, 2) = arr1(j, 2)
- j = d("b " & arr(i, 8)): If j Then arr(i, 3) = arr2(j, 2)
- j = d("c " & arr(i, 5)): If j Then arr(i, 4) = arr3(j, 2)
- Next: Cells(1, 1).Resize(UBound(arr), UBound(arr, 2)).Value2 = arr: Set d = Nothing
- End Sub
复制代码 |
|