Adding multiple page breaks - at start of each day

H

Hate-Excel-Need

Hi all,

I'm hoping to find a simple way to add page breaks in my template to th
start of each day, to make it more printer friendly.

Originally, I had planned to use =IF(b1>b2,"Page",1) command in column
to determine where I wanted the page breaks to be, then use Go to
Constants - Text, to add page breaks on each "Page" cell. However,
only get a page break in the first instance.


Day 1 1737 Data 1
Day 1 1752 Data 1
Day 1 1800 Data 1
Day 1 1827 Data 1
Day 1 1830 Data 1
Day 1 1930 Data 1
Day 1 2030 Data 1
Day 1 2230 Data 1
Day 1 2330 Data 1
Day 2 0000 Data Page
Day 2 0030 Data 1
Day 2 0100 Data 1
Day 2 0200 Data 1
Day 2 0230 Data 1
Day 2 0300 Data 1


I'm hoping someone here knows a simple way to accomplish this
preferably without resorting to VB scripting, as I am a VB noob
 
G

GS

Hate-Excel-Need was thinking very hard :
Hi all,

I'm hoping to find a simple way to add page breaks in my template to the
start of each day, to make it more printer friendly.

Originally, I had planned to use =IF(b1>b2,"Page",1) command in column D
to determine where I wanted the page breaks to be, then use Go to -
Constants - Text, to add page breaks on each "Page" cell. However, I
only get a page break in the first instance.


Day 1 1737 Data 1
Day 1 1752 Data 1
Day 1 1800 Data 1
Day 1 1827 Data 1
Day 1 1830 Data 1
Day 1 1930 Data 1
Day 1 2030 Data 1
Day 1 2230 Data 1
Day 1 2330 Data 1
Day 2 0000 Data Page
Day 2 0030 Data 1
Day 2 0100 Data 1
Day 2 0200 Data 1
Day 2 0230 Data 1
Day 2 0300 Data 1


I'm hoping someone here knows a simple way to accomplish this,
preferably without resorting to VB scripting, as I am a VB noob.

Have you tried using PageBreak Preview?

--
Garry

Free usenet access at http://www.eternal-september.org
ClassicVB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion
 
C

Claus Busch

Hi,

Am Thu, 19 Apr 2012 06:28:20 +0000 schrieb Hate-Excel-Need:
Originally, I had planned to use =IF(b1>b2,"Page",1) command in column D
to determine where I wanted the page breaks to be, then use Go to -
Constants - Text, to add page breaks on each "Page" cell. However, I
only get a page break in the first instance.

try:

Sub PageBreaks()
Dim LRow As Long
Dim i As Long

LRow = Cells(Rows.Count, 1).End(xlUp).Row
For i = 1 To LRow
If Cells(i + 1, 1) <> Cells(i, 1) Then
With ActiveSheet
.HPageBreaks.Add Range("A" & i + 1)
End With
End If
Next
End Sub


Regards
Claus Busch
 
H

Hate-Excel-Need

Claus said:
Hi,

Am Thu, 19 Apr 2012 06:28:20 +0000 schrieb Hate-Excel-Need:
-

try:

Sub PageBreaks()
Dim LRow As Long
Dim i As Long

LRow = Cells(Rows.Count, 1).End(xlUp).Row
For i = 1 To LRow
If Cells(i + 1, 1) <> Cells(i, 1) Then
With ActiveSheet
.HPageBreaks.Add Range("A" & i + 1)
End With
End If
Next
End Sub


Regards
Claus Busch

Thanks Claus,

But I'm afraid that's mostly ancient greek to me. Any chance you coul
give me some explanation as to how that works, and how to apply it?

Thank
 
C

Claus Busch

Hi,

Am Mon, 23 Apr 2012 07:50:05 +0000 schrieb Hate-Excel-Need:
But I'm afraid that's mostly ancient greek to me. Any chance you could
give me some explanation as to how that works, and how to apply it?

press ALT+F11, make a right-click on your project and choose "Insert
Modul", copy the code into the code window.
Back in Excel you can run the macro.


Regards
Claus Busch
 

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