Setting and removing page breaks

  • Thread starter Thread starter jday
  • Start date Start date
J

jday

I have an Excel worksheet where I want to insert a page break at certain
rows---providing the row has not been hidden by the user. Here is an example
of the code I am using to insert one of the page breaks:

If Range("A70").EntireRow.Hidden = False Then
Rows("70:70").Select
ActiveWindow.SelectedSheets.HPageBreaks.add Before:=ActiveCell
Else
End If

This code works great, however, I want to create a similar routine to remove
an existing page break if it exists. In other words, using the above
example, I want it to look at row 70 to see if there is a page break, and if
so, remove it. In this code, I want the page break to be removed regardless
of whether the row is hidden or not. What is the best way to accomplish this?
 
Worksheets("Sheet1").Rows(70).PageBreak = xlPageBreakNone

If this post helps click Yes
 
Back
Top