daily pastebin goal
20%
SHARE
TWEET

Untitled

a guest Oct 12th, 2017 44 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Sub SetPageBreaks(SheetObj As Worksheet)
  2.  
  3.     Dim TotRow%, LinesPerPg%, NumPgs%, Page%
  4.  
  5.     TotRow = SheetObj.UsedRange.Rows.Count
  6.     LinesPerPg = 56
  7.     NumPgs = RoundUp(TotRow / LinesPerPg)
  8.  
  9.     With SheetObj
  10.         .ResetAllPageBreaks
  11.         For Page = 1 To NumPgs
  12.             .Rows(LinesPerPg * Page + 1).PageBreak = xlPageBreakManual
  13.         Next Page
  14.         .Columns("J").PageBreak = xlPageBreakManual
  15.         .Columns("H").PageBreak = xlPageBreakNone
  16.     End With
  17.  
  18. End Sub
  19.  
  20. Function RoundUp(ByVal Number As Double) As Long
  21.     RoundUp = Application.WorksheetFunction.RoundUp(Number, 0)
  22. End Function
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top