我正在尝试在我的vba代码上设置分页符。我有条件基础上的水平分页符。现在我需要在F列上添加一个垂直分页符(所以包括F列,但右边没有其他内容)。
Statement.Activate
ActiveSheet.ResetAllPageBreaks
Dim c As Range
Dim FirstAddress As String
Set c = Columns("A").Find(What:="Please enter Dept. 42 and your Client Ref on the reverse", LookIn:=xlValues, LookAt:=xlWhole, MatchCase:=True)
If Not c Is Nothing Then
FirstAddress = c.Address
Do
ActiveWindow.SelectedSheets.HPageBreaks.Add Before:=c.Offset(1)
Set c = Columns("A").FindNext(c)
Loop While Not c Is Nothing And c.Address <> FirstAddress
ActiveSheet.VPageBreaks.Add Before:=Range("H1")
End If
正如我所说,水平的工作,但我在D列和F列得到一个额外的垂直,我不需要,我似乎无法摆脱它。有什么想法吗?
谢谢