Adding multiple page breaks - at start of each day
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
|