SonGunnar
New Member
- Joined
- Jul 20, 2008
- Messages
- 5
Problems:
Groups of data should not split at inserted page breaks.
Row heights vary at the 3rd and 5th row of each 7 row group.
Typical pages have between 4 and 6 groups.
Average projects contain 10 - 50 pages, or 40 - 250 groups.
What I am trying to do is adjust the height of every 5th and 7th blank rows of each group on each page to fill the available paper space (78 points x 9" = 702 points).
Macro:
Sub DpageBreaks()
' points per inch times inches 78 points x 9 inches
Const sngH As Single = 78# * 9#
' lines of scope to keep together equal to 1 estimate scope item, j
Const iGroup As Integer = 7
Dim i As Long, j As Long
Dim rPA As Range
ActiveSheet.ResetAllPageBreaks
Set rPA = Range("Print_Area")
i = 4
j = i + iGroup - 1
Do
Do
If Range(rPA(i, 1), rPA(j, 1)).Height > sngH Then
ActiveSheet.HPageBreaks.Add before:=Rows(j - iGroup + 1)
Exit Do
Else
j = j + iGroup
End If
Loop While j < rPA.Rows.Count
i = j - iGroup + 1
j = i + iGroup - 1
Loop While i < rPA.Rows.Count
End Sub
Your help is truly appreciated
Groups of data should not split at inserted page breaks.
Row heights vary at the 3rd and 5th row of each 7 row group.
Typical pages have between 4 and 6 groups.
Average projects contain 10 - 50 pages, or 40 - 250 groups.
What I am trying to do is adjust the height of every 5th and 7th blank rows of each group on each page to fill the available paper space (78 points x 9" = 702 points).
Macro:
Sub DpageBreaks()
' points per inch times inches 78 points x 9 inches
Const sngH As Single = 78# * 9#
' lines of scope to keep together equal to 1 estimate scope item, j
Const iGroup As Integer = 7
Dim i As Long, j As Long
Dim rPA As Range
ActiveSheet.ResetAllPageBreaks
Set rPA = Range("Print_Area")
i = 4
j = i + iGroup - 1
Do
Do
If Range(rPA(i, 1), rPA(j, 1)).Height > sngH Then
ActiveSheet.HPageBreaks.Add before:=Rows(j - iGroup + 1)
Exit Do
Else
j = j + iGroup
End If
Loop While j < rPA.Rows.Count
i = j - iGroup + 1
j = i + iGroup - 1
Loop While i < rPA.Rows.Count
End Sub
Your help is truly appreciated
