|
本帖最后由 hefuqing 于 2018-8-21 17:47 编辑
- Sub sds()
- Dim brr(), crr()
- arr = [a1].CurrentRegion
- Set d = CreateObject("scripting.dictionary")
- Set d1 = CreateObject("scripting.dictionary")
- Set d2 = CreateObject("scripting.dictionary")
- Set d3 = CreateObject("scripting.dictionary")
- For i = 1 To UBound(arr)
- d(arr(i, 1) & "/" & arr(i, 2)) = ""
- d2(arr(i, 1) & "/" & arr(i, 3)) = ""
- Next
- k = d.keys
- k2 = d2.keys
- For i = 0 To d.Count - 1
- n = n + 1
- ReDim Preserve brr(1 To 3, 1 To n)
- brr(1, n) = Split(k(i), "/")(0)
- brr(2, n) = Split(k(i), "/")(1)
- Next
- For i = 0 To d2.Count - 1
- n2 = n2 + 1
- ReDim Preserve crr(1 To 3, 1 To n2)
- crr(1, n2) = Split(k2(i), "/")(0)
- crr(2, n2) = Split(k2(i), "/")(1)
- Next
- For i = 1 To UBound(brr, 2)
- d1(brr(1, i)) = d1(brr(1, i)) & "/" & brr(2, i)
- Next
- k1 = d1.keys
- t1 = d1.items
- For i = 1 To UBound(crr, 2)
- d3(crr(1, i)) = d3(crr(1, i)) & "/" & crr(2, i)
- Next
- k3 = d3.keys
- t3 = d3.items
- [F1].Resize(d1.Count, 1) = Application.Transpose(k1)
- For i = 0 To d1.Count - 1
- n1 = n1 + 1
- Cells(n1, 7) = Mid(t1(i), 2)
- Next
- For i = 0 To d3.Count - 1
- n3 = n3 + 1
- Cells(n3, 8) = Mid(t3(i), 2)
- Next
- End Sub
复制代码 |
|