View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
[email protected] glimmer23@yahoo.com is offline
external usenet poster
 
Posts: 18
Default Formating Print Margins

Ok I know this code is wrong and correct to an extent. On first run (on
any particular sheet) it come up with an error on the SET and just
breaks the page into 3. on the second run it sets the page breaks.

pretty much what i am tring to do is get it so this macro will be
assigned to a buttn you press the button and regardless of what the
users have done to the print layout it will set it to 3 pages high with
the pages breaks in the correct places.

Sub actuals()

Sheet12.PageSetup.PrintArea = "$A$1:$AQ$215"
With Sheet12.PageSetup
.FitToPagesWide = 1
.FitToPagesTall = 3
End With
Sheet12.ResetAllPageBreaks

Sheet12.HPageBreaks(1).Location = Range("A68", "A141")
Sheet12.HPageBreaks(2).Location = Range("A141", "A215")

Set Sheet12.HPageBreaks(1).Location = Range("A68", "A141")
Set Sheet12.HPageBreaks(2).Location = Range("A141", "A215")

End Sub