Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel 2007 VBA HPageBreak

Status
Not open for further replies.

swtrader

IS-IT--Management
Dec 23, 2004
182
US
1921 static rows. Print area BD1:BQ1921
Autofilter is used on Column BD to hide unpopulated rows. In this example, BD1:BQ625 are populated and BD963:BQ1121 are populated. When printed, the report breaks at row 1024. I have tried various syntax to try to force a break at row 963 including the following:
Worksheets(1).HPageBreaks(1).Location = Worksheets(1).Range("BD963")

Have also tried:

ActiveSheet.PageSetup.PrintArea = "$BD$1:$BQ$1921"
Range("BD964").Select
ActiveWindow.SelectedSheets.HPageBreaks.Add Before:=ActiveCell

Neither worked. What am I missing?

swtrader
-- If you don't know where you're going, you'll always know when you're not there.
 



hi,

VBA is best handled in forum707.
Code:
    With Sheets(1)
        .HPageBreaks.Add .Range("BD963")
    End With

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top