更新一下。。。- Sub ykcbf() '//2024.7.29
- Set d = CreateObject("Scripting.Dictionary")
- r = Cells(Rows.Count, 1).End(3).Row
- arr = [a1].Resize(r, 2)
- ReDim brr(1 To UBound(arr), 1 To 2)
- For i = 3 To UBound(arr)
- s = arr(i, 1)
- If Not d.exists(s) Then
- m = m + 1
- d(s) = m
- brr(m, 1) = arr(i, 1)
- b = Split(arr(i, 2), "/")
- brr(m, 2) = b(0)
- For x = 1 To UBound(b)
- brr(m, 2) = IIf(InStr(brr(m, 2), b(x)), brr(m, 2), brr(m, 2) & "/" & b(x))
- Next
- Else
- r = d(s)
- brr(r, 2) = IIf(InStr(brr(r, 2), arr(i, 2)), brr(r, 2), brr(r, 2) & "/" & arr(i, 2))
- End If
- Next
- [d3:e10000] = ""
- [d3].Resize(m, 2) = brr
- MsgBox "OK!"
- End Sub
复制代码
|