Thanks jolivanes. This is almost what I need. I really need to figure out how to keep the three column groupings together (Qty/Rate/Amount), since not having them together is not ideal for client viewing. (Note: once all formatting is complete, I save the file to pdf and that is what gets sent to the client.) Below is an update to the code, which includes additional formatting, as well as to horizontal page breaks.
What you have sent over so far is great! Any other ideas on how to incorporate the single discount column(s) into the process?
Sub Set_Page_Breaks_B()
Const lNumberOfColumnsPerSheet As Integer = 15 '<---- Change to your amount of columns per sheet
Dim c As Long, LastColumn As Long
LastColumn = Cells.find(What:="*", After:=[A1], SearchOrder:=xlByColumns, SearchDirection:=xlPrevious).Column
ActiveSheet.ResetAllPageBreaks
ActiveWindow.SelectedSheets.VPageBreaks.Add Before:=Cells(lNumberOfColumnsPerSheet + 5) '<---- 2 equals Title Columns + 1
For c = lNumberOfColumnsPerSheet + 5 To LastColumn Step lNumberOfColumnsPerSheet '<----- Change 2 to 3 if 2 Title Columns in your document
ActiveWindow.SelectedSheets.VPageBreaks.Add Before:=Cells(c)
Next c
' With ActiveSheet.PageSetup
' .PrintArea = ActiveSheet.UsedRange.Address
' .PrintTitleColumns = "$A:$D" '<----- Change to the Title Columns in your document
' End With
' Check to see which version of Office is running. "PrintCommunication" command only works on Office 2010 or greater.
' If Office 2010 or greater (version 14), then turn off print communication to speed up the code when modifying page setup.
If Val(Application.Version) >= 14 Then Application.PrintCommunication = False
With ActiveSheet.PageSetup
.PrintTitleRows = ""
.PrintTitleColumns = "$A:$D"
.TopMargin = Application.InchesToPoints(1.3)
.Orientation = xlLandscape
.PaperSize = xlPaperLetter
.Zoom = 47
End With
' Turn print communication back on
If Val(Application.Version) >= 14 Then Application.PrintCommunication = True
' Turn on Page Break Preview to adjust horizonal page breaks
ActiveWindow.View = xlPageBreakPreview
' If Horizontal Page Break count not = 0 then proceed.
If HPBcnt <> 0 Then
Set rng = Range("A" & LROffset)
Set Hrng = Worksheets(1).HPageBreaks(1).Location
' If Horizontal Page Break (HPB) row is less than bottom of Print Area, then move HPB down to bottom, else move it up.
If Hrng.Row < rng.Row Then
ActiveSheet.HPageBreaks(1).DragOff Direction:=xlDown, RegionIndex:=1
Else
ActiveSheet.HPageBreaks(1).DragOff Direction:=xlUp, RegionIndex:=1
End If
End If
' Turn off Page Break Preview
ActiveWindow.View = xlNormalView
End Sub
Bookmarks