View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Claus Busch Claus Busch is offline
external usenet poster
 
Posts: 3,872
Default Page Breaks in VBA Q

Hi Sean,

Am Mon, 23 Jul 2012 04:02:39 -0700 (PDT) schrieb :

I have the macro below to print a range A:HB to 29 pages, problem is however that the Page breaks are not consistent, how can I alter the page breaks within the macro?


if you have 6 columns per page you will get 30 pages. If you have 7
columns per page you will get 27 pages.

Sub Print_Per()
Dim i As Integer

With Sheets("Month")
With .PageSetup
.PrintArea = "$A$66:$HB$99"
.Orientation = xlLandscape
.PaperSize = xlPaperA4
.FirstPageNumber = xlAutomatic
.Order = xlDownThenOver
End With

.ResetAllPageBreaks
.HPageBreaks.Add .Range("I100")
For i = 1 To 29
.VPageBreaks.Add .Cells(1, i * 7)
Next
End With
ActiveWindow.SelectedSheets.PrintOut Copies:=1

Application.Goto Sheets("Header").Range("A1")
End Sub


Regards
Claus Busch
--
Win XP PRof SP2 / Vista Ultimate SP2
Office 2003 SP2 /2007 Ultimate SP2