|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
- Sub test()
- Dim r%, i%
- Dim arr, brr
- With Worksheets("sheet3")
- r = .Cells(.Rows.Count, 1).End(xlUp).Row
- c = .Cells(2, .Columns.Count).End(xlToLeft).Column
- arr = .Range("a2").Resize(r - 1, c)
- ReDim brr(1 To 1000, 1 To 8)
- m = 0
- For i = 2 To UBound(arr)
- For j = 7 To UBound(arr, 2)
- If arr(i, j) <> 0 Then
- m = m + 1
- For k = 1 To 6
- brr(m, k) = arr(i, k)
- Next
- brr(m, 7) = arr(i, j)
- brr(m, 8) = arr(1, j)
- End If
- Next
- Next
- End With
- With Worksheets("汇总")
- .Cells.Clear
- .Range("a2").Resize(m, UBound(brr, 2)) = brr
- End With
- End Sub
复制代码 |
评分
-
2
查看全部评分
-
|