|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
Sub test2()
Dim i As Integer
Dim dic As Object
Dim arr
arr = Range("a1:b60")
Set dic = CreateObject("scripting.dictionary")
For i = 3 To UBound(arr)
If Not dic.exists(arr(i, 1)) Then
n = n + 1
dic(arr(i, 1)) = arr(i, 2)
Cells(3 + n, 5) = arr(i, 1)
Cells(3 + n, 6) = arr(i, 2)
Else
For j = 1 To dic.Count
If Cells(3 + j, 5) = arr(i, 1) Then
Cells(3 + j, 100).End(xlToLeft).Offset(0, 1) = arr(i, 2)
End If
Next
End If
Next
End Sub |
评分
-
1
查看全部评分
-
|