View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Jacob Skaria Jacob Skaria is offline
external usenet poster
 
Posts: 8,520
Default Setting and removing page breaks

Worksheets("Sheet1").Rows(70).PageBreak = xlPageBreakNone

If this post helps click Yes
---------------
Jacob Skaria


"jday" wrote:

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 Befo=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?