Created
November 26, 2013 10:39
-
-
Save zhimiaoli/7656368 to your computer and use it in GitHub Desktop.
根据单元格内容自动创建分页符
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sub createPageBreak() | |
'创建分页 | |
'在小计后面添加手动分页 | |
For i = 1 To 10000 '只到10000行 | |
If Cells(i, 1) = "小计" Then '设置分行内容 | |
Cells(i, 1).Select | |
ActiveCell.Offset(1, 1).Rows("1:1").EntireRow.Select | |
ActiveWindow.SelectedSheets.HPageBreaks.Add Before:=ActiveCell | |
End If | |
Next | |
End Sub |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment