|
- Sub test()
- Set d = CreateObject("Scripting.Dictionary")
- With Sheets("测试数据")
- r = .Cells(Rows.Count, 1).End(3).Row
- arr = .Range("a4:h" & r)
- End With
- For i = 1 To UBound(arr)
- If arr(i, 8) <> "" Then
- d(arr(i, 8)) = d(arr(i, 8)) & "," & i
- Else
- s = s & "," & i
- End If
- Next
- ReDim brr(1 To UBound(arr) * 2, 1 To 9)
- For Each k In d.keys
- a = Split(d(k), ",")
- n = n + 1
- r = n
- m = m + 1
- brr(n, 1) = m
- brr(n, 2) = k
- For i = 1 To UBound(a)
- n = n + 1
- For j = 3 To 9
- brr(n, j) = arr(a(i), j - 1)
- Next
- brr(r, 6) = brr(r, 6) + brr(n, 6)
- Next
- d(k) = Array(r + 4, n - r)
- Next
- b = Split(s, ",")
- For i = 1 To UBound(b)
- n = n + 1
- m = m + 1
- brr(n, 1) = m
- brr(n, 2) = arr(b(i), 2)
- For j = 4 To 8
- brr(n, j) = arr(b(i), j - 1)
- Next
- Next
- With Sheets("行成效果")
- .[a4].Resize(n, 9) = brr
- .[a4].Resize(n, 9).Borders.LineStyle = 1
- c = d.items
- For i = 0 To UBound(c)
- .Rows(c(i)(0)).Resize(c(i)(1)).Rows.Group
- Next
- End With
- End Sub
复制代码 |
评分
-
1
查看全部评分
-
|