ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   inserting page breaks automtically (https://www.excelbanter.com/excel-programming/341446-inserting-page-breaks-automtically.html)

hywt

inserting page breaks automtically
 

Hi

I have a spreadsheet which I need to print out and distribute.

There are 5000 rows and the data starts in row 10. Rows 1 -9 contai
some general information that needs to be included at the top of ever
printed page

Column A contains a location and there needs to be a page break a
every change in data:

LOC 1
LOC 1
LOC 1
PAGE BREAK
LOC 2
LOC 2
LOC 2
PAGE BREAK
LOC 3
LOC 3


There are approximately 800 different locations.

Can anyone provide any pointers?

Thanks
And

--
hyw
-----------------------------------------------------------------------
hywt's Profile: http://www.excelforum.com/member.php...fo&userid=2765
View this thread: http://www.excelforum.com/showthread.php?threadid=47172


Tom Ogilvy

inserting page breaks automtically
 
Sub AB()
Dim rng As Range, cell As Range
Set rng = Range(Cells(10, 1), Cells(Rows.Count, 1).End(xlUp))
For Each cell In rng
If cell.Value < cell.Offset(-1, 0).Value _
And cell.Row < 10 Then
ActiveSheet.HPageBreaks.Add Befo=cell
End If
Next
End Sub

--
Regards,
Tom Ogilvy





"hywt" wrote in message
...

Hi

I have a spreadsheet which I need to print out and distribute.

There are 5000 rows and the data starts in row 10. Rows 1 -9 contain
some general information that needs to be included at the top of every
printed page

Column A contains a location and there needs to be a page break at
every change in data:

LOC 1
LOC 1
LOC 1
PAGE BREAK
LOC 2
LOC 2
LOC 2
PAGE BREAK
LOC 3
LOC 3


There are approximately 800 different locations.

Can anyone provide any pointers?

Thanks
Andy


--
hywt
------------------------------------------------------------------------
hywt's Profile:

http://www.excelforum.com/member.php...o&userid=27656
View this thread: http://www.excelforum.com/showthread...hreadid=471729




hywt[_2_]

inserting page breaks automtically
 

Many thanks Tom. Worked first time and saved me a few hours working ou
how to write it.

Andre

--
hyw
-----------------------------------------------------------------------
hywt's Profile: http://www.excelforum.com/member.php...fo&userid=2765
View this thread: http://www.excelforum.com/showthread.php?threadid=47172



All times are GMT +1. The time now is 05:13 PM.

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