|
- Sub 本页合计()
- 删除合计
- ActiveSheet.ResetAllPageBreaks
- s = 0: ss = 0
- r = [b65536].End(3).Row
- For i = 4 To r + 100
- s = s + Cells(i, 4): ss = ss + Cells(i, 4)
- If Cells(i, 1) > 0 And Cells(i, 1) Mod 29 = 0 Then
- Rows(i + 1).Resize(2).Insert
- Cells(i + 1, 2) = "本页合计": Cells(i + 1, 4) = s
- Cells(i + 2, 2) = "累 计": Cells(i + 2, 4) = ss
- Cells(i + 1, 1).Resize(2, 6).Font.Bold = True
- ActiveSheet.HPageBreaks.Add Before:=Cells(i + 3, 1)
- i = i + 2
- s = 0
- End If
- Next
- i = [b65536].End(3).Row
- Cells(i + 1, 2) = "本页合计": Cells(i + 1, 4) = s
- Cells(i + 2, 2) = "累 计": Cells(i + 2, 4) = ss
- Cells(i + 1, 1).Resize(2, 6).Font.Bold = True
- Cells(i + 1, 1).Resize(2, 6).Borders.LineStyle = 1
- End Sub
- Sub 删除合计()
- For i = [b65536].End(3).Row To 4 Step -1
- If Cells(i, 2) = "本页合计" Then Rows(i).Delete
- If Cells(i, 2) = "累 计" Then Rows(i).Delete
- Next
- End Sub
复制代码 |
|