|
- Sub qs()
- Dim arr, i, dic
- Set dic = CreateObject("scripting.dictionary")
- Set d2 = CreateObject("scripting.dictionary")
- With Sheet1
- arr = .Range("a1").CurrentRegion.Value
- ReDim brr(1 To UBound(arr), 1 To 4)
- For i = 2 To UBound(arr)
- s = arr(i, 1)
- If Not dic.exists(s) Then
- m = m + 1
- dic(s) = m
- For j = 1 To UBound(arr, 2)
- brr(m, j) = arr(i, j)
- Next
- Else
- r = dic(s)
- For x = 2 To UBound(arr, 2)
- brr(r, x) = brr(r, x) & "、" & arr(i, x)
- y = Split(brr(r, x), "、")
- For Each YY In y
- If Len(YY) Then
- d2(YY) = ""
- End If
- Next
- brr(r, x) = Join(d2.keys, "、")
- d2.RemoveAll
- Next x
- End If
- Next i
- .Range("g2").Resize(m, 4) = brr
- End With
- End Sub
复制代码 |
|