|
3#
楼主 |
发表于 2009-2-20 09:39:49
|
只看该作者
2# pureshadow
问题已经解决,来自OFFICE精英俱乐部,wxyqxxz2007
Sub pipei()
Set d = CreateObject("scripting.dictionary")
With Sheets("sheet2")
r = .Range("a65536").End(xlUp).Row
ar = .Range("a2:c" & r)
End With
For i = 1 To UBound(ar)
If Not d.exists(ar(i, 2)) Then d(ar(i, 2)) = ar(i, 1) & "//" & ar(i, 3)
Next
With Sheets("sheet1")
r = .Range("a65536").End(xlUp).Row
ar = .Range("a2:c" & r)
For i = 1 To UBound(ar)
If d.exists(ar(i, 1)) Then
ar(i, 2) = Split(d(ar(i, 1)), "//")(0)
ar(i, 3) = Split(d(ar(i, 1)), "//")(1)
End If
Next
.Range("b2").Resize(UBound(ar)) = Application.Index(ar, 0, 2)
.Range("c2").Resize(UBound(ar)) = Application.Index(ar, 0, 3)
End With
End Sub |
|