ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Page Breaks when data is NOT on column "A" (https://www.excelbanter.com/excel-programming/332540-page-breaks-when-data-not-column.html)

BEEJAY

Page Breaks when data is NOT on column "A"
 
The following works great EXCEPT it needs to put the
break in column A, NOT in B.
Help Please.
BeeJay

Dim OldVal As String
Dim Rng As Range
With Application
.Calculation = xlManual
.ScreenUpdating = False
End With
OldVal = Range("B1")
StartTime = Timer
For Each Rng In Range("B1:B10000") '<< change range

If Rng.Text < OldVal Then
Rng.PageBreak = xlPageBreakManual
OldVal = Rng.Text
End If
Next Rng

MsgBox Timer - StartTime

With Application
.Calculation = xlAutomatic
.ScreenUpdating = True
End With

MsgBox "COMPLETE!"

End Sub


bhofsetz[_69_]

Page Breaks when data is NOT on column "A"
 

Try using the Horizontal Page Break rather than just th
xlPageBreakManual

xlHPageBreaks.Ad

--
bhofset
-----------------------------------------------------------------------
bhofsetz's Profile: http://www.excelforum.com/member.php...fo&userid=1880
View this thread: http://www.excelforum.com/showthread.php?threadid=38129



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

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