Page Break Object and the HPage Breaks Collection Example

Sub AddHPageBreaks()

Dim oCell As Range

'Loop through all the cells in the first column of

the sheet

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


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

the cell

If oCell.Font.Size = 16 Then

ActiveSheet.HPageBreaks.Add oCell

End If


End Sub

0 0

Post a comment