|
参与一下。。。
- Sub ykcbf() '//2024.5.21
- With Sheets("数据")
- r = .UsedRange.Find("*", searchdirection:=2).Row
- c = .UsedRange.Columns.Count
- arr = .[a1].Resize(r, c)
- End With
- ReDim brr(1 To 10000, 1 To 6)
- For i = 4 To UBound(arr)
- m = m + 1
- For j = 1 To UBound(arr, 2) Step 5
- brr(m, 3) = brr(m, 3) + arr(i, j + 1)
- brr(m, 4) = brr(m, 4) + arr(i, j + 3)
- brr(m, 5) = brr(m, 5) + arr(i, j + 2)
- brr(m, 6) = brr(m, 6) + arr(i, j + 4)
- Next
- brr(m, 1) = brr(m, 3) + brr(m, 5)
- brr(m, 2) = brr(m, 4) + brr(m, 6)
- Next
- With Sheets("查询")
- .UsedRange.Offset(3).Clear
- .[a1].Resize(1, 6).Interior.Color = 49407
- .[a2].Resize(1, 6).Interior.Color = 5296274
- With .[a4].Resize(m, 6)
- .Value = brr
- .Borders.LineStyle = 1
- .HorizontalAlignment = xlCenter
- .VerticalAlignment = xlCenter
- With .Font
- .Name = "微软雅黑"
- .Size = 11
- End With
- End With
- End With
- MsgBox "OK!"
- End Sub
复制代码
|
|