Setting and removing page breaks

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?
 
J

Jacob Skaria

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

If this post helps click Yes
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top