I have received outstanding support in another thread (reps given) so I am bringing this request to a new thread.
I am having trouble formatting the print range of my report along with identifying where I want my page breaks to be.
The criteria I am looking for is:
Print Range: Columns A to U
Rows to repeat at top: 1-3
Gridlines : Yes
Orientation: Landscape
Margins - Top/Left/Bottom/Right all 0.2
Header: 0.5
Footer: 0.5
I would like for my page breaks to be placed 3 rows above every time column A has 401010 (except for the first page)
Here is what I have so far....this formats everything correctly except for the page breaks.
Report is also attached.
PHP Code:
Sub SFCST_PRINT_FORMAT()
'
' SFCST_PRINT_FORMAT Macro
' SFCST PRINT FORMAT
''Range("H1,I1,J1").EntireColumn.Delete
'
'
Application.PrintCommunication = False
With ActiveSheet.PageSetup
.PrintTitleRows = "$1:$3"
.PrintTitleColumns = ""
End With
Application.PrintCommunication = True
ActiveSheet.PageSetup.PrintArea = "$A:$U"
Application.PrintCommunication = False
With ActiveSheet.PageSetup
.LeftHeader = ""
.CenterHeader = ""
.RightHeader = "&B&D &T"
.LeftFooter = ""
.CenterFooter = "&B Page &P of &N"
.RightFooter = ""
.LeftMargin = Application.InchesToPoints(0.2)
.RightMargin = Application.InchesToPoints(0.2)
.TopMargin = Application.InchesToPoints(0.2)
.BottomMargin = Application.InchesToPoints(0.2)
.HeaderMargin = Application.InchesToPoints(0.5)
.FooterMargin = Application.InchesToPoints(0.5)
.PrintHeadings = False
.PrintGridlines = True
.PrintComments = xlPrintSheetEnd
.CenterHorizontally = False
.CenterVertically = False
.Orientation = xlLandscape
.Draft = False
.PaperSize = xlPaperLetter
.FirstPageNumber = 1
.Order = xlDownThenOver
.BlackAndWhite = False
.Zoom = False
.FitToPagesWide = 1
.FitToPagesTall = 990
.PrintErrors = xlPrintErrorsDisplayed
.OddAndEvenPagesHeaderFooter = False
.DifferentFirstPageHeaderFooter = False
.ScaleWithDocHeaderFooter = True
.AlignMarginsHeaderFooter = False
.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
Cells.Select
Cells.EntireColumn.AutoFit
ActiveSheet.ResetAllPageBreaks
col = 1 ' what ever column you want to measure.
LastRw = ActiveSheet.UsedRange.Rows.Count
For x = 5 To LastRw
If Cells(x, col) = "401010" Then
ActiveWindow.SelectedSheets.HPageBreaks.Add Before:=Cells(x - 3, col)
End If
Next
End Sub
Bookmarks