ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   How can I insert data into my spreadsheet without the page breaks. (https://www.excelbanter.com/excel-worksheet-functions/198700-how-can-i-insert-data-into-my-spreadsheet-without-page-breaks.html)

J D

How can I insert data into my spreadsheet without the page breaks.
 
I have a large spreadsheet that includes various lists of people who work in
different areas. I set it up to print with page breaks in between each group.
The problem is when I add or delete people from the lists. When I insert or
delete names and shift cells up or down, the page breaks shift also. Then I
have to go back in and change all the page breaks. Is there a way to lock
page breaks?

ryguy7272

How can I insert data into my spreadsheet without the page breaks.
 
Can you try to insert page breaks, dynamically, after the data in the page
changes? Try the macro below, but make a backup first, just in case the
results are not what you want.

Sub pagebreak()
Dim value1 As String
Dim value2 As String

Range("A2").Select
Do While ActiveCell.Value < ""
value1 = ActiveCell.Value
ActiveCell.Offset(1, 0).Select
value2 = ActiveCell.Value
If value1 < value2 Then
ActiveCell.EntireRow.Select
ActiveWindow.SelectedSheets.HPageBreaks.Add Befo=ActiveCell
Else
End If
Loop
End Sub


Regards,
Ryan---

--
RyGuy


"J D" wrote:

I have a large spreadsheet that includes various lists of people who work in
different areas. I set it up to print with page breaks in between each group.
The problem is when I add or delete people from the lists. When I insert or
delete names and shift cells up or down, the page breaks shift also. Then I
have to go back in and change all the page breaks. Is there a way to lock
page breaks?



All times are GMT +1. The time now is 07:11 PM.

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