|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
- Sub test()
- Dim r%, i%
- Dim arr, brr
- Dim d As Object
- Set d = CreateObject("scripting.dictionary")
- With Worksheets("sheet2")
- r = .Cells(.Rows.Count, 1).End(xlUp).Row
- arr = .Range("a2:f" & r)
- For i = 1 To UBound(arr)
- d(arr(i, 6)) = Array(arr(i, 1), arr(i, 5))
- Next
- End With
- With Worksheets("sheet1")
- r = .Cells(.Rows.Count, 1).End(xlUp).Row
- For i = 2 To r
- If d.exists(.Cells(i, 3).Value) Then
- .Cells(i, 9).Resize(1, 2) = d(.Cells(i, 3).Value)
- End If
- Next
- End With
-
- End Sub
复制代码 |
|