|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
- Sub test()
- Dim r%, i%
- Dim arr, brr
- Dim d As Object
- Set d = CreateObject("scripting.dictionary")
- With Worksheets("数据")
- r = .Cells(.Rows.Count, 1).End(xlUp).Row
- arr = .Range("a2:j" & r)
- For i = 1 To UBound(arr)
- d(arr(i, 1)) = arr(i, 10)
- Next
- End With
- With Worksheets("统计")
- r = .Cells(.Rows.Count, 1).End(xlUp).Row
- arr = .Range("a2:b" & r)
- For i = 1 To UBound(arr)
- If d.exists(arr(i, 1)) Then
- arr(i, 2) = d(arr(i, 1))
- End If
- Next
- .Range("a2:b" & r) = arr
- End With
- End Sub
复制代码 |
|