ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Insert row after a page break (https://www.excelbanter.com/excel-programming/372866-insert-row-after-page-break.html)

Benlejedi

Insert row after a page break
 
Hi,

I have created a subtotal with page breaks.
I insert a row after the subtotal to insert some headers.
The problem is that the new row always before the page break appears.

Can anyone help me for this ?

Thanks a lot in advance

Benjamin


roundabout[_6_]

Insert row after a page break
 

OK. Lets say you've inserted your subtotals and then manually inserted a
row below each of these subtotals.

You now have a series of blank rows where you want to insert your new
header.

So... Highlight the active cells in column A (assuming column A is the
column you performed your subtotals on) then try this. It should insert
a page break above each blank row.

Sub PB()
'
'Inserts page break BEFORE each blank row
'
For Each cell In Selection
If cell = "" Then
ActiveSheet.HPageBreaks.Add cell
End If
Next cell
End Sub

Hope it works!

Lee

Benlejedi wrote:
*Hi,

I have created a subtotal with page breaks.
I insert a row after the subtotal to insert some headers.
The problem is that the new row always before the page break
appears.

Can anyone help me for this ?

Thanks a lot in advance

Benjamin *




--
roundabout
------------------------------------------------------------------------
Posted via http://www.mcse.ms
------------------------------------------------------------------------
View this thread: http://www.mcse.ms/message2512130.html





All times are GMT +1. The time now is 01:09 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com