|
- Sub test()
- Dim r%, i%
- Dim arr, brr
- Dim d As Object
- Set d = CreateObject("scripting.dictionary")
- With Worksheets("sheet1")
- r = .Cells(.Rows.Count, 1).End(xlUp).Row
- arr = .Range("a2:e" & r)
- For i = 1 To UBound(arr)
- If Not d.exists(arr(i, 3)) Then
- ReDim brr(1 To 4)
- For j = 1 To 4
- brr(j) = arr(i, j + 1)
- Next
- Else
- brr = d(arr(i, 3))
- brr(1) = brr(1) & "/" & arr(i, 2)
- brr(3) = brr(3) & "/" & arr(i, 4)
- brr(4) = brr(4) & "/" & arr(i, 4)
- End If
- d(arr(i, 3)) = brr
- Next
- .Range("i2").Resize(d.Count, UBound(brr)) = Application.Transpose(Application.Transpose(d.items))
- End With
- End Sub
复制代码 |
评分
-
2
查看全部评分
-
|