Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 25
Default no page break in named range

I have a sheet that has about 110 named ranges in it. They are about
15 rows tall (they can vary). What I would like to do is when I go to
print (11x17) a named range will not get cut off (i.e. part on one
page and part on the next page) Like a keep together. A macro that
would insert the page breaks on the sheet would work great.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default no page break in named range

Sub AddBreaks()

With ActiveSheet
For Each NamedRange In Names
'remove the equal sign
addr = Mid(NamedRange.RefersTo, 2)
StartRow = Range(addr).Row
NumRows = Range(addr).Rows.Count
EndRow = StartRow + NumRows - 1
.HPageBreaks.Add Befo=Range("A" & (EndRow + 1))
Next NamedRange
End With
End Sub


"Chris Salcedo" wrote:

I have a sheet that has about 110 named ranges in it. They are about
15 rows tall (they can vary). What I would like to do is when I go to
print (11x17) a named range will not get cut off (i.e. part on one
page and part on the next page) Like a keep together. A macro that
would insert the page breaks on the sheet would work great.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 25
Default no page break in named range

On Mar 11, 10:24*am, Joel wrote:
Sub AddBreaks()

With ActiveSheet
* *For Each NamedRange In Names
* * * 'remove the equal sign
* * * addr = Mid(NamedRange.RefersTo, 2)
* * * StartRow = Range(addr).Row
* * * NumRows = Range(addr).Rows.Count
* * * EndRow = StartRow + NumRows - 1
* * * .HPageBreaks.Add Befo=Range("A" & (EndRow + 1))
* *Next NamedRange
End With
End Sub

"Chris *Salcedo" wrote:
I have a sheet that has about 110 named ranges in it. They are about
15 rows tall (they can vary). What I would like to do is when I go to
print (11x17) a named range will not get cut off (i.e. part on one
page and part on the next page) Like a keep together. A macro that
would insert the page breaks on the sheet would work great.


This works but not exactly what I need..

Each range can be variable and I would like to have more than one
range per sheet. just not split a range if its in the middle...

Some thing like: if range fits page no page break if not then page
break at previous end named range...
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
Excel 2007 Page Break Adjustments causes a page break each cell BKaufman Excel Worksheet Functions 2 September 10th 10 05:02 AM
return what page a named range is on Chris Salcedo Excel Programming 1 January 29th 07 01:35 AM
Show only matches between a named cell range and the values in a page field - vba maverick502 Excel Programming 1 January 25th 07 05:00 PM
adding a new page break to an existing page break Edward Letendre Excel Discussion (Misc queries) 1 March 6th 05 09:29 AM
How to Programmatically Insert a Page Break Every Nth Row in a Range KK[_3_] Excel Programming 0 November 21st 03 12:49 AM


All times are GMT +1. The time now is 05:44 AM.

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

About Us

"It's about Microsoft Excel"