Thread: Auto Page Break
View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
JAB
 
Posts: n/a
Default Auto Page Break

Ok, that latest macro worked for what it was written for. But, what I
thought was going to work, doesn't. Now, I need it to do a page break ever
3rd time the word "print" appears. Any chance I could get a macro for that?

JB

"Ardus Petus" wrote:

Try:
For lRow = 1 + lPageLength To .UsedRange.Rows.Count Step lPageLength
(add a dot before UsedRange).
If it does not work, please post back

--
AP

"JAB" a écrit dans le message de news:
...
When I go to run it, it says, "run-time error '424'", "object required" ,
then it points me to "For lRow = 1 + lPageLength To UsedRange.Rows.Count
Step
lPageLength"

I have no idea where to go from here.

JB

"Ardus Petus" wrote:

Sub setPageBreaks()
Const lPageLength As Long = 85
Dim lRow As Long
ActiveWindow.View = xlPageBreakPreview
With ActiveSheet
.ResetAllPageBreaks
For lRow = 1 + lPageLength To UsedRange.Rows.Count Step
lPageLength
.HPageBreaks.Add befo=Rows(lRow)
Next lRow
End With
ActiveWindow.View = xlNormalView
End Sub

HTH
--
AP

"JAB" a écrit dans le message de news:
...
I need to have a page break every 85th row. I need this done
automatically,
because I have over 3800 rows. Any help is appreciated.

JB