|
- Sub su45()
- Application.ScreenUpdating = False
- rw = Cells(Rows.Count, 1).End(3).Row
- a = 52
- Do While a < rw + b + 2
- x = 50
- If b = 0 Then x = 51
- Rows(a).Insert
- Cells(a, 1) = "合计"
- Cells(a, 3) = Application.Sum(Range(Cells(a - x, 3), Cells(a - 1, 3)))
- Cells(a, 4) = Application.Sum(Range(Cells(a - x, 4), Cells(a - 1, 4)))
- Cells(a, 6) = Application.Sum(Range(Cells(a - x, 6), Cells(a - 1, 6)))
- If a = rw + b + 1 Then Exit Do
- b = b + 1
- a = a + 51
- If a > rw + b Then a = rw + b + 1
- Loop
- ActiveCell.PrintOut '打印表格
- '下面是清除表中的合计行
- a = 52
- Do While Cells(a, 1) <> ""
- If Cells(a, 1) = "合计" Then
- Rows(a).Delete
- End If
- a = a + 1
- Loop
- End Sub
复制代码 |
|