- Sub yy()
- Dim d, k, t, Arr, i&
- Set d = CreateObject("Scripting.Dictionary")
- Sheet3.Activate
- Arr = [a1].CurrentRegion
- For i = 2 To UBound(Arr)
- d(Arr(i, 1)) = d(Arr(i, 1)) & i & ","
- Next
- k = d.keys
- t = d.items: n = 1
- Cells(1, 8).Resize(1, UBound(Arr, 2)) = Application.Index(Arr, 1, 0)
- For i = 0 To UBound(k)
- t(i) = Left(t(i), Len(t(i)) - 1)
- If InStr(t(i), ",") Then
- aa = Split(t(i), ",")
- For j = 0 To UBound(aa)
- n = n + 1
- Cells(n, 8).Resize(1, UBound(Arr, 2)) = Application.Index(Arr, aa(j), 0)
- Next
- End If
- Next
- End Sub
复制代码 |