Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 709
Default foce region to print on one page

I have a macro that generates a number of summary blocks and places them one
under the other.

The individual blocks are less than 10-rows high and are less than one page
wide.

Is there a way to make sure that no individual summary block is split
between two pages?

--
Richard
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 586
Default foce region to print on one page

Your post is a little vague to me, so I will have to make some assumptions.
You will need to set Horizontal Page Breaks every block to get each block on
its own page. I think you need to know how many blocks you have. I will
assum you have 15 and every block is exactly 10 rows long. You may have to
set your print area before you do this. Just Select all the 10 row "blocks"
and then Page Layout Set Print Area then run this code. Once your code has
ran you can choose which pages you want to print. Hope this helps.

Option Explicit

Sub PrintBlocks()

Dim i As Long

For i = 1 To 15
Sheets("Sheet1").HPageBreaks.Add Befo=Cells(i * 10 + 1, 1)
Next i

End Sub

Ryan


"Richard" wrote:

I have a macro that generates a number of summary blocks and places them one
under the other.

The individual blocks are less than 10-rows high and are less than one page
wide.

Is there a way to make sure that no individual summary block is split
between two pages?

--
Richard

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,117
Default foce region to print on one page

richard - i took a different approach. i'm working from the bottom
up, assuming that each block is more than one line wide, and that each
block is of varying widths........
=============================
Option Explicit

Sub print_sheets()

Dim myLastRow As Long
Dim myRange As Range
Dim myRange2 As Range
Dim i As Long

myLastRow = ActiveSheet.Cells(20000, 1).End(xlUp).Row

Do Until i = 1
Set myRange = ActiveSheet.Range("a" & myLastRow)
i = myRange.End(xlUp).Row
Set myRange2 = ActiveSheet.Range("a" & i & ":d" & myLastRow)
myRange.PrintOut
'MsgBox myRange2.Address

Set myRange = ActiveSheet.Range("a" & i)
myLastRow = myRange.End(xlUp).Row
Loop

End Sub
=========================
to test the macro it, i'd uncomment the MsgBox & comment out
the .PrintOut so you don't waste tons of paper. the messagebox will
give you the address of each block. my test block only went to column
D, so you'll need to change that........
hope it works for you!
:)
susan




On Jun 24, 3:22*pm, RyanH wrote:
Your post is a little vague to me, so I will have to make some assumptions. *
You will need to set Horizontal Page Breaks every block to get each block on
its own page. *I think you need to know how many blocks you have. *I will
assum you have 15 and every block is exactly 10 rows long. *You may have to
set your print area before you do this. *Just Select all the 10 row "blocks"
and then Page Layout Set Print Area then run this code. *Once your code has
ran you can choose which pages you want to print. *Hope this helps.

Option Explicit

Sub PrintBlocks()

Dim i As Long

* * For i = 1 To 15
* * * * Sheets("Sheet1").HPageBreaks.Add Befo=Cells(i * 10 + 1, 1)
* * Next i

End Sub

Ryan



"Richard" wrote:
I have a macro that generates a number of summary blocks and places them one
under the other.


The individual blocks are less than 10-rows high and are less than one page
wide.


Is there a way to make sure that no individual summary block is split
between two pages?


--
Richard- Hide quoted text -


- Show quoted text -


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
Paste values all cells in a region which refers to out of region Vijay Excel Worksheet Functions 0 August 25th 09 06:03 AM
Setting the print area in page set up to print 1 page wide by 2 pages tall EA[_2_] Excel Discussion (Misc queries) 2 July 12th 07 08:39 PM
How do I print a one page spreadsheet multiple time, each with its own page number? lhsallwasser Excel Discussion (Misc queries) 4 August 17th 05 03:00 PM
Select current region and print Tempy Excel Programming 2 April 20th 05 05:47 AM
Any way to print only region with text? Mickee Excel Programming 1 May 19th 04 02:41 AM


All times are GMT +1. The time now is 02:38 AM.

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"