MrPink1986
Active Member
- Joined
- May 1, 2012
- Messages
- 252
Hi,
I have a macro in a file which exports the data from a sheet and saves which is fine. This sheet is also printed and It is required over 2 pages. Currently when using the code I have used to define the page breaks it prints to 3 pages. The data is defined and remains static from A3:S112.
I require the page breaks in the following ranges - A3:S68 and A69:S112.
The code I am currently using is below - it also formats the cells for me as there are a lot of merged cells in the text.
How is the best way to ensure the page breaks are set to where I would like them.
I have a macro in a file which exports the data from a sheet and saves which is fine. This sheet is also printed and It is required over 2 pages. Currently when using the code I have used to define the page breaks it prints to 3 pages. The data is defined and remains static from A3:S112.
I require the page breaks in the following ranges - A3:S68 and A69:S112.
The code I am currently using is below - it also formats the cells for me as there are a lot of merged cells in the text.
How is the best way to ensure the page breaks are set to where I would like them.
Code:
' formatWorkflow Macro
'
'
Application.CutCopyMode = False
Application.PrintCommunication = False
With ActiveSheet.PageSetup
.PrintTitleRows = ""
.PrintTitleColumns = ""
End With
Application.PrintCommunication = True
ActiveSheet.PageSetup.PrintArea = ""
Application.PrintCommunication = False
With ActiveSheet.PageSetup
.LeftHeader = ""
.CenterHeader = ""
.RightHeader = ""
.LeftFooter = ""
.CenterFooter = ""
.RightFooter = ""
.LeftMargin = Application.InchesToPoints(0.7)
.RightMargin = Application.InchesToPoints(0.7)
.TopMargin = Application.InchesToPoints(0.75)
.BottomMargin = Application.InchesToPoints(0.75)
.HeaderMargin = Application.InchesToPoints(0.3)
.FooterMargin = Application.InchesToPoints(0.3)
.PrintHeadings = False
.PrintGridlines = False
.PrintComments = xlPrintNoComments
.PrintQuality = 600
.CenterHorizontally = False
.CenterVertically = False
.Orientation = xlLandscape
.Draft = False
.PaperSize = xlPaperA4
.FirstPageNumber = xlAutomatic
.Order = xlDownThenOver
.BlackAndWhite = False
.Zoom = 100
.PrintErrors = xlPrintErrorsDisplayed
.OddAndEvenPagesHeaderFooter = False
.DifferentFirstPageHeaderFooter = False
.ScaleWithDocHeaderFooter = True
.AlignMarginsHeaderFooter = True
.EvenPage.LeftHeader.Text = ""
.EvenPage.CenterHeader.Text = ""
.EvenPage.RightHeader.Text = ""
.EvenPage.LeftFooter.Text = ""
.EvenPage.CenterFooter.Text = ""
.EvenPage.RightFooter.Text = ""
.FirstPage.LeftHeader.Text = ""
.FirstPage.CenterHeader.Text = ""
.FirstPage.RightHeader.Text = ""
.FirstPage.LeftFooter.Text = ""
.FirstPage.CenterFooter.Text = ""
.FirstPage.RightFooter.Text = ""
End With
Application.PrintCommunication = True
ActiveWindow.SmallScroll Down:=93
Range("A3:S112").Select
Range("S112").Activate
ActiveSheet.PageSetup.PrintArea = "$A$3:$S$112"
ActiveWindow.View = xlPageBreakPreview
ActiveSheet.VPageBreaks(1).DragOff Direction:=xlToRight, RegionIndex:=1
Worksheets("Weekly Workflow").Rows(69).PageBreak = xlPageBreakManual
Columns("A:V").Select
Selection.ColumnWidth = 24#