ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   automatically put in page break after 14 lines. (https://www.excelbanter.com/excel-programming/336087-automatically-put-page-break-after-14-lines.html)

Steved

automatically put in page break after 14 lines.
 
Hello from Steved

Is it possible please to have a line break put in after every 14 lines please.

If this is possible How.

Thankyou.



Nigel

automatically put in page break after 14 lines.
 
You are limited to 1026 Horizontal page breaks per worksheet, so you cannot
fill you whole sheet of 65536 rows every 14 lines. But if you need less
than 1026 try this....... set the xr range to the maximum number of used
rows.

Sub PageBreaks()
Dim xr As Long
For xr = 15 To 500 Step 14
ActiveWindow.SelectedSheets.HPageBreaks.Add Befo=Cells(xr, 1)
Next xr
End Sub

--
Cheers
Nigel



"Steved" wrote in message
...
Hello from Steved

Is it possible please to have a line break put in after every 14 lines

please.

If this is possible How.

Thankyou.





Steved

automatically put in page break after 14 lines.
 
Excellent thanks very much

I only reqiure just over 50, so this will do nicely.

"Nigel" wrote:

You are limited to 1026 Horizontal page breaks per worksheet, so you cannot
fill you whole sheet of 65536 rows every 14 lines. But if you need less
than 1026 try this....... set the xr range to the maximum number of used
rows.

Sub PageBreaks()
Dim xr As Long
For xr = 15 To 500 Step 14
ActiveWindow.SelectedSheets.HPageBreaks.Add Befo=Cells(xr, 1)
Next xr
End Sub

--
Cheers
Nigel



"Steved" wrote in message
...
Hello from Steved

Is it possible please to have a line break put in after every 14 lines

please.

If this is possible How.

Thankyou.







All times are GMT +1. The time now is 01:46 PM.

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