View Single Post
  #4   Report Post  
Hate-Excel-Need Hate-Excel-Need is offline
Junior Member
 
Posts: 3
Default

Quote:
Originally Posted by Claus Busch View Post
Hi,

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

Originally, I had planned to use =IF(b1b2,"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
--
Win XP PRof SP2 / Vista Ultimate SP2
Office 2003 SP2 /2007 Ultimate SP2
Thanks Claus,

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?

Thanks