|
参与一下。。。
- Sub ykcbf() '//2024.8.27
- Set d = CreateObject("Scripting.Dictionary")
- Set d1 = CreateObject("Scripting.Dictionary")
- arr = Sheets("Sheet1").UsedRange
- ReDim brr(1 To UBound(arr), 1 To UBound(arr, 2))
- For i = 4 To UBound(arr)
- s = arr(i, 2)
- If Not d.exists(s) Then
- m = m + 1
- d(s) = m
- brr(m, 1) = m
- For j = 2 To UBound(arr, 2)
- brr(m, j) = arr(i, j)
- Next
- Else
- r = d(s)
- brr(r, 3) = brr(r, 3) & "、" & arr(i, 3)
- brr(r, 4) = brr(r, 4) & "、" & arr(i, 4)
- brr(r, 5) = brr(r, 5) & "、" & arr(i, 5)
- End If
- Next
- On Error Resume Next
- For i = 1 To UBound(brr)
- For j = 3 To 5
- d1.RemoveAll: st = ""
- b = Split(brr(i, j), "、")
- For x = 0 To UBound(b)
- d1(CStr(b(x))) = ""
- Next
- brr(i, j) = Join(d1.keys, "、")
- Next
- Next
- With Sheets("Sheet2")
- .UsedRange.ClearContents
- .[a4].Resize(m, UBound(arr, 2)) = brr
- End With
- MsgBox "OK!"
- End Sub
复制代码
|
评分
-
1
查看全部评分
-
|