|
Sub test()
Dim A, d, i
'1)写入
Set d = CreateObject("scripting.dictionary")
Sheets(1).Select
A = Range("a1").CurrentRegion
For i = 2 To UBound(A)
d(A(i, 1)) = A(i, 2)
Next i
'2)查询
Sheets(2).Select
If [b2] <> "" Then End
A = Range("a1").CurrentRegion
For i = 2 To UBound(A)
A(i, 2) = d(A(i, 1))
Next i
[A1].Resize(UBound(A), 2) = A
'3)删除重复
Cells(i, 1).Resize(d.Count) = Application.Transpose(d.keys)
Cells(i, 2).Resize(d.Count) = Application.Transpose(d.items)
[A1].CurrentRegion.RemoveDuplicates Columns:=1, Header:=xlYes
End Sub
|
评分
-
查看全部评分
|