Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 64
Default Can I keep rows together so they don't separate at a pagebreak?

I am creating a form in Excel. The rows may expand as the user enters data.
Is there any way to keep each "section" in the form together, so that a
ssection does not split at a page break but jumps in its entirety to the next
page? I know I can do this in Word, but this form has lots of serious
calculations so it must be in Excel.
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Can I keep rows together so they don't separate at a pagebreak?

Excel makes a very poor word processor.

I think you'll have to do this manually if you really need it.

On the other hand, MSWord can do light calculations within its tables. But
maybe your calculations are too serious???

Rita wrote:

I am creating a form in Excel. The rows may expand as the user enters data.
Is there any way to keep each "section" in the form together, so that a
ssection does not split at a page break but jumps in its entirety to the next
page? I know I can do this in Word, but this form has lots of serious
calculations so it must be in Excel.


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 64
Default Can I keep rows together so they don't separate at a pagebreak

Dave,
I know Excel is not a good word processor, but as I said in my original
post, I have serious calculations and formulas (lookups, if statements) so it
has to be done in Excel.

I am doing it manually now, I was looking for the possibility of a more
dynamic solution.

But thanks anyway.


"Dave Peterson" wrote:

Excel makes a very poor word processor.

I think you'll have to do this manually if you really need it.

On the other hand, MSWord can do light calculations within its tables. But
maybe your calculations are too serious???

Rita wrote:

I am creating a form in Excel. The rows may expand as the user enters data.
Is there any way to keep each "section" in the form together, so that a
ssection does not split at a page break but jumps in its entirety to the next
page? I know I can do this in Word, but this form has lots of serious
calculations so it must be in Excel.


--

Dave Peterson

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 611
Default Can I keep rows together so they don't separate at a pagebreak?

Rita,

This can be done with a macro if all the row heights are the same, if you're
willing to get into that. I suppose it could be done where the row heights
are not the same too.

It might not be worth the macro effort, unless the sheet is very large. If
you do a print preview, it will put the page breaks on the sheet with dotted
lines. Or you can use View - Page Break Preview. Now that the page breaks
are visible, you can manually either put in and remove page breaks as needed
to keep the groups together, or insert rows, depending on how you want to
handle it.
--
Earl Kiosterud
www.smokeylake.com
-----------------------------------------------------------------------
"Rita" wrote in message
...
I am creating a form in Excel. The rows may expand as the user enters
data.
Is there any way to keep each "section" in the form together, so that a
ssection does not split at a page break but jumps in its entirety to the
next
page? I know I can do this in Word, but this form has lots of serious
calculations so it must be in Excel.



  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 64
Default Can I keep rows together so they don't separate at a pagebreak

Earl
The row heights will not be the same. What would the macro do? How would I
tell it to keep the rows together?

I can't do it the seond way you suggest because it must be as automatic as
possible. There will be many different end users. I've put in a manual
break, which will work if no one gets too verbose. I just thought if there
was a (reasonably straightforward) way to automate it, that would be better.

Thanks for your reply.
Rita

"Earl Kiosterud" wrote:

Rita,

This can be done with a macro if all the row heights are the same, if you're
willing to get into that. I suppose it could be done where the row heights
are not the same too.

It might not be worth the macro effort, unless the sheet is very large. If
you do a print preview, it will put the page breaks on the sheet with dotted
lines. Or you can use View - Page Break Preview. Now that the page breaks
are visible, you can manually either put in and remove page breaks as needed
to keep the groups together, or insert rows, depending on how you want to
handle it.
--
Earl Kiosterud
www.smokeylake.com
-----------------------------------------------------------------------
"Rita" wrote in message
...
I am creating a form in Excel. The rows may expand as the user enters
data.
Is there any way to keep each "section" in the form together, so that a
ssection does not split at a page break but jumps in its entirety to the
next
page? I know I can do this in Word, but this form has lots of serious
calculations so it must be in Excel.






  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 611
Default Can I keep rows together so they don't separate at a pagebreak

Rita

Here's a macro that will move page breaks up to keep groups together,
Word-style.

Sub KeepTogether()
Const ColumnKey = 3 ' Key column for groups
Dim HCtr As Double
Dim i As Integer, j As Integer

ActiveSheet.ResetAllPageBreaks
HCtr = 0 ' Total row height accumulator for page
i = 1 ' row counter
Do While Cells(i, ColumnKey) < ""
HCtr = HCtr + Rows(i).Height ' accumulate height
i = i + 1 ' next row
If HCtr 650 Then ' one row past vertical height max
For j = i To 0 Step -1 ' go back through rows
If Cells(i, ColumnKey) < Cells(i - 1, ColumnKey) Then Exit For ' middle
of group, found a break, get out
i = i - 1
Next j
ActiveWindow.SelectedSheets.HPageBreaks.Add Befo=Cells(i,
ColumnKey).EntireRow
HCtr = 0
End If ' HCtr
Loop
End Sub

Set ColumnKey to the column on which it's to group. It's hard-wired for 11"
paper with total top and bottom margin space of 2". It's barebones and not
very tested. If there's a group that is more than one page, I think it will
melt down. Once working, it would probably go in the Before_Print routine
in module ThisWorkbook.
--
Earl Kiosterud
www.smokeylake.com
-----------------------------------------------------------------------
"Rita" wrote in message
...
Earl
The row heights will not be the same. What would the macro do? How would
I
tell it to keep the rows together?

I can't do it the seond way you suggest because it must be as automatic as
possible. There will be many different end users. I've put in a manual
break, which will work if no one gets too verbose. I just thought if
there
was a (reasonably straightforward) way to automate it, that would be
better.

Thanks for your reply.
Rita

"Earl Kiosterud" wrote:

Rita,

This can be done with a macro if all the row heights are the same, if
you're
willing to get into that. I suppose it could be done where the row
heights
are not the same too.

It might not be worth the macro effort, unless the sheet is very large.
If
you do a print preview, it will put the page breaks on the sheet with
dotted
lines. Or you can use View - Page Break Preview. Now that the page
breaks
are visible, you can manually either put in and remove page breaks as
needed
to keep the groups together, or insert rows, depending on how you want to
handle it.
--
Earl Kiosterud
www.smokeylake.com
-----------------------------------------------------------------------
"Rita" wrote in message
...
I am creating a form in Excel. The rows may expand as the user enters
data.
Is there any way to keep each "section" in the form together, so that a
ssection does not split at a page break but jumps in its entirety to
the
next
page? I know I can do this in Word, but this form has lots of serious
calculations so it must be in Excel.






  #7   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 64
Default Can I keep rows together so they don't separate at a pagebreak

Wow! Thanks, I will give this a try.

Rita

"Earl Kiosterud" wrote:

Rita

Here's a macro that will move page breaks up to keep groups together,
Word-style.

Sub KeepTogether()
Const ColumnKey = 3 ' Key column for groups
Dim HCtr As Double
Dim i As Integer, j As Integer

ActiveSheet.ResetAllPageBreaks
HCtr = 0 ' Total row height accumulator for page
i = 1 ' row counter
Do While Cells(i, ColumnKey) < ""
HCtr = HCtr + Rows(i).Height ' accumulate height
i = i + 1 ' next row
If HCtr 650 Then ' one row past vertical height max
For j = i To 0 Step -1 ' go back through rows
If Cells(i, ColumnKey) < Cells(i - 1, ColumnKey) Then Exit For ' middle
of group, found a break, get out
i = i - 1
Next j
ActiveWindow.SelectedSheets.HPageBreaks.Add Befo=Cells(i,
ColumnKey).EntireRow
HCtr = 0
End If ' HCtr
Loop
End Sub

Set ColumnKey to the column on which it's to group. It's hard-wired for 11"
paper with total top and bottom margin space of 2". It's barebones and not
very tested. If there's a group that is more than one page, I think it will
melt down. Once working, it would probably go in the Before_Print routine
in module ThisWorkbook.
--
Earl Kiosterud
www.smokeylake.com
-----------------------------------------------------------------------
"Rita" wrote in message
...
Earl
The row heights will not be the same. What would the macro do? How would
I
tell it to keep the rows together?

I can't do it the seond way you suggest because it must be as automatic as
possible. There will be many different end users. I've put in a manual
break, which will work if no one gets too verbose. I just thought if
there
was a (reasonably straightforward) way to automate it, that would be
better.

Thanks for your reply.
Rita

"Earl Kiosterud" wrote:

Rita,

This can be done with a macro if all the row heights are the same, if
you're
willing to get into that. I suppose it could be done where the row
heights
are not the same too.

It might not be worth the macro effort, unless the sheet is very large.
If
you do a print preview, it will put the page breaks on the sheet with
dotted
lines. Or you can use View - Page Break Preview. Now that the page
breaks
are visible, you can manually either put in and remove page breaks as
needed
to keep the groups together, or insert rows, depending on how you want to
handle it.
--
Earl Kiosterud
www.smokeylake.com
-----------------------------------------------------------------------
"Rita" wrote in message
...
I am creating a form in Excel. The rows may expand as the user enters
data.
Is there any way to keep each "section" in the form together, so that a
ssection does not split at a page break but jumps in its entirety to
the
next
page? I know I can do this in Word, but this form has lots of serious
calculations so it must be in Excel.






Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Print separate reports with same column heading [email protected] Excel Discussion (Misc queries) 4 September 1st 06 09:46 PM
macro to copy multiple rows to separate worksheets OrlaH Excel Worksheet Functions 2 June 8th 06 03:15 PM
(Unsuccessfully!) Unhiding Rows in Excel 2003 [email protected] Excel Worksheet Functions 6 May 24th 06 08:17 PM
print multiple, separate rows on each page DPixie Excel Discussion (Misc queries) 1 April 21st 05 06:40 AM
How can I separate rows to the bottom of the page with missing inf Mcobra41 Excel Discussion (Misc queries) 2 February 28th 05 04:51 PM


All times are GMT +1. The time now is 07:13 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"