Page Break Object and the VPage Breaks Collection Example

Sub AddVPageBreaks()

Dim oCell As Range

'Loop through all the cells in the first column

of the sheet

For Each oCell In ActiveSheet.UsedRange.Rows(l).


'If the font size is 16, add a page break to

the left of the cell

If oCell.Font.Size = 16 Then

ActiveSheet.VPageBreaks.Add oCell

End If


End Sub

0 0

Post a comment