View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Brad Brad is offline
external usenet poster
 
Posts: 846
Default Help with Design

The project that I'm working on has up to four pages of text and one page of
values.

The requirement is that a "paragraph" of text not be split between two pages
(bottom of one page and the top of another). The text will always start in
column A. The text is not wrapped in a single cell but the text is in
multiple cells. If a particular rows (column A) is blank - there will be no
text in that row.

The text is flexible in that if (for example) a premium bonus doesn't exist
I'm hiding the rows that deal with that topic ... There could be as few as
two pages and as many as 4 pages of text.

I'm struggling with how to do this. But this is my current thinking... (any
suggestions would be welcome)

Sub SetPages()

Dim TotalHeight As Double
Dim MaxHeight As Double
Dim PRow As Integer
Dim CRow As Integer

Dim Cellcheck As Range

MaxHeight = 77

Set rngsht1 = shtGPA9D.Rows("1:250")
Set Cellcheck = shtGPA9D("A1:A250")
TotalHeight = 0
PRow = 0
CRow = 0

For Each R In rngsht1
If Cellcheck(R) = " " Then
PRow = CRow
CRow = R
End If

TotalHeight = TotalHeight + R.RowHeight
If TotalHeight MaxHeight Then
'pagebreak somehow
'reset my counters

End If
Next R
Debug.Print ("total row height " & totheight)
End Sub

Am I anywhere close???