Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Print long sheet shared on pages

Hi

I'm struggling with the following problem.
I have an excel sheet that exists of two columns, name and e-mail.
Now, I have to print the entire sheet, but it is about 2500 rows long.

Is there a possibility to let excel print it twice per page?

So, for example:

Instead of printing the following (consider it to be a long list):

Jack Higgins
Peter Jackson

....
....
-- here would be the end of the first printed page
Mike Wilson

Joe Placido k.placido
....
....
-- here would be the end of te second printed page

Excel should be able to print it in the following way:

Jack Higgins
Mike Wilson

Peter Jackson
Joe Placido

..... ....
..... ....
..... ....


I'm a little familiar with programming in excel, but not so much in
implementing
it (with vb, for example). If you use such a method, please also
explain
how to implement it.

Thanks a lot in advance
pygmalion

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Print long sheet shared on pages


Jack Higgins Mike Wilson

Peter Jackson Joe Placido

.... ....
.... ....
....


For the record, the e-mail address of the right cells should be on the
same line, after the name.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 694
Default Print long sheet shared on pages

Try this.

It takes a while on 2500 rows.

Sub compressrows()
Dim s As String
Dim linesperpage As Long ' how many lines per page
Dim rss As Long ' source row start
Dim rse As Long ' source row end
Dim r As Long ' row counter
Dim wsn As Worksheet ' new worksheet
Dim skip As Boolean ' flag for skipping none moving data

On Error GoTo error_line
s = InputBox("", "How many lines per page?", 60)
If s = "" Then Exit Sub ' catch cancel
linesperpage = CLng(s) ' convert to long
Application.ScreenUpdating = False
ActiveSheet.Copy , ActiveSheet ' copy sheet
Set wsn = ActiveSheet
' get first and last rows
rss = wsn.UsedRange.Row ' start row
rse = rss + wsn.UsedRange.rows.Count - 1 'end row
' get lines per page manual way.....
skip = True
For r = rss To rse Step linesperpage
If skip = False Then 'move alternate block
With wsn.Range(Cells(r, 1), Cells(r + linesperpage - 1, 2))
.Copy wsn.Cells(r - linesperpage, 3)
.Clear
End With
End If
skip = Not skip
Next r
'delete rows
For r = rse To rss Step -1
If wsn.Cells(r, 1) = "" Then
wsn.rows(r).Delete
End If
Next r
error_line:
Application.ScreenUpdating = True
End Sub--
Hope this helps
Martin Fishlock
Please do not forget to rate this reply.


"pygmalion" wrote:


Jack Higgins Mike Wilson

Peter Jackson Joe Placido

.... ....
.... ....
....


For the record, the e-mail address of the right cells should be on the
same line, after the name.


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
How print pages without including the first sheet? Mark F[_2_] New Users to Excel 2 June 2nd 09 03:27 AM
Breaking a long column to print on one sheet Pathwalker Excel Discussion (Misc queries) 1 August 30th 08 08:15 PM
How to print multiple pages per sheet MKG Excel Discussion (Misc queries) 3 May 22nd 08 03:46 PM
Print multiple pages on one sheet Dorci Excel Discussion (Misc queries) 5 July 11th 07 06:36 PM
Print 2 pages per sheet Andrew B[_4_] Excel Programming 3 June 7th 06 01:33 PM


All times are GMT +1. The time now is 11:15 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"