|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
Sub test()
Dim arr, i%, d
Set d = CreateObject("Scripting.Dictionary")
With Sheets(1)
arr = .Range("a2").CurrentRegion
For i = 3 To UBound(arr)
If d.exists(arr(i, 3)) = False Then
d(arr(i, 3)) = i
End If
Next
End With
With Sheets(2)
arr = .Range("a2").CurrentRegion
For i = 3 To UBound(arr)
If d.exists(arr(i, 3)) Then
d(arr(i, 3)) = arr(i, 2)
End If
Next
End With
Sheets(1).Range("b3").Resize(d.Count, 2) = Application.Transpose(Array(d.items, d.keys))
End Sub
|
|