Print multiple worksheets per page->How?

jhallgren

Board Regular
Joined
Feb 26, 2004
Messages
74
Kinda a beginner at this...have tried various ways...looked thru help...need to print a set of six small (15 or so rows by 10 or so cols) sheets in same XLS file with custom headings on a few pages as possible...ideally 2 or 3...but each sheet seems to end up on diff page...what am I missing? Thanks!
 
Hi jhallgren

This is a direct cut-and-paste from the 6 December 2003 ExcelTips :

-----------------------------------------------------
Printing Multiple Worksheets on a Single Page
-----------------------------------------------------
Workbooks can contain all sorts of data. If you have a workbook that includes a number of worksheets, each containing only a small amount
of data, you may wonder if there is a way to print the multiple worksheets on a single sheet of paper.

There are a couple of ways that you can approach a solution to this problem. The first is simply print multiple pages per sheet, using the
capabilities of your printer driver. For instance, I have an older HP
LaserJet, and the printer driver allows me to specify the number of
pages to print per sheet of paper. If I wanted to print three or four
single-page worksheets all on one piece of paper, all I need to do is
follow these steps:

1. Choose Print from the File menu. Excel displays the Print dialog
box.
2. In the Print What area of the dialog box, choose the Entire
Workbook option.
3. Click the Properties button. Excel displays the Properties
dialog box for the printer, with the Layout tab selected.
4. Set the Pages Per Sheet control to 4.
5. Click OK to close the Properties dialog box.
6. Click OK to actually print the worksheets.

Your printer may offer a similar capability to what is outlined here,
but you may need to do some exploring through the printer's Properties
dialog box to find that capability. Of course, printing this way can
lead to some very small text on the printout, because the printer
driver simply reduces each page to occupy a proportionate area of the
printed page. If you want to reduce some of the white space, and
thereby increase the size of the printed text, then you need to look
for a different solution.

Many people, to consolidate what is printed, actually create a
"printing worksheet" which contains nothing but references to the
areas to be printed on the other worksheets in the workbook. These
references can either be done through formulas referring to the data
on each worksheet, or by using the camera tool in Excel. (The camera
tool has been described in other issues of ExcelTips.)

For an automated solution of amalgamating multiple worksheets into a
single worksheet, you can use a macro. The following macro will create
a new worksheet at the end of your workbook and copy the contents from
all the other workbooks into it.

Code:
     Sub PrintOnePage()
         Dim wshTemp As Worksheet, wsh As Worksheet
         Dim rngArr() As Range, c As Range
         Dim i As Integer
         Dim j As Integer
     
         ReDim rngArr(1 To 1)
         For Each wsh In ActiveWorkbook.Worksheets
             i = i + 1
             If i > 1 Then   ' resize array
                 ReDim Preserve rngArr(1 To i)
             End If
     
             On Error Resume Next
             Set c = wsh.Cells.SpecialCells(xlCellTypeLastCell)
             If Err = 0 Then
                 On Error GoTo 0
     
                 'Prevent empty rows
                 Do While Application.CountA(c.EntireRow) = 0 _
                   And c.EntireRow.Row > 1
                     Set c = c.Offset(-1, 0)
                 Loop
     
                 Set rngArr(i) = wsh.Range(wsh.Range("A1"), c)
             End If
         Next wsh
     
         'Add temp.Worksheet
         Set wshTemp = Sheets.Add(after:=Worksheets(Worksheets.Count))
     
         On Error Resume Next
         With wshTemp
             For i = 1 To UBound(rngArr)
                 If i = 1 Then
                     Set c = .Range("A1")
                 Else
                     Set c = _
                       ActiveSheet.Cells.SpecialCells(xlCellTypeLastCell)
                     Set c = c.Offset(2, 0).End(xlToLeft)  ' skip one row
                 End If
     
                 'Copy-paste range (prevent empty range)
                 If Application.CountA(rngArr(i)) > 0 Then
                     rngArr(i).Copy c
                 End If
             Next i
         End With
         On Error GoTo 0
     
         Application.CutCopyMode = False ' prevent marquies
     
         With ActiveSheet.PageSetup     ' Fit to 1 page
             .Zoom = False
             .FitToPagesWide = 1
             .FitToPagesTall = 1
         End With
     
         'Preview New Sheet
         ActiveWindow.SelectedSheets.PrintPreview
     
         'Print Desired Number of Copies
         i = InputBox("Print how many copies?", "ExcelTips", 1)
         If IsNumeric(i) Then
             If i > 0 Then
                 ActiveSheet.PrintOut Copies:=i
             End If
         End If
     
         'Delete temp.Worksheet?
         If MsgBox("Delete the temporary worksheet?", _
           vbYesNo, "ExcelTips") = vbYes Then
             Application.DisplayAlerts = False
             wshTemp.Delete
             Application.DisplayAlerts = True
         End If
     End Sub
After the combined worksheet is put together, the macro displays the
worksheet using Print Preview. When you close Print Preview, it asks
how many copies of the worksheet you want to print. If you enter a
number greater than zero, then that many copies are printed. Finally,
the macro offers to delete the combined worksheet for you just before
finishing.

Hope that helps.

anvil19
:o
 
Upvote 0
:-D THANK YOU! That was an EXCELLENT reply...except for one small detail...didn't tell this newbie WHERE to find ExcelTips! Found it via search of other threads...

And what type of formula would one use to refer to the "active" section of Sheet1/2/3,etc to put in SheetSum for instance?
 
Upvote 0
Hi again jhallgren

The oversight is duly noted.

About the second question. You could use the following code to select all the active cells in a sheet.

Code:
Sub SelectActiveCells()
    Dim vara As String
    Dim varb As String

    vara = "A1"
    varb = ActiveSheet.Cells.SpecialCells(xlCellTypeLastCell).Address

    ActiveSheet.Range(vara & ":" & varb).Select
End Sub

You could use this code in a loop to select and copy the active cells on a sheet to another sheet.

Just be aware that a sheets active cells are not always the last ones that has data in them. I do have a bit of code that will be rid of empty cells after the last used cell should you want it.

Hope that helps

anvil19
:o
 
Upvote 0
Hey this macro is very good, but is it possible that instead of copying all worksheets throughout the workbook to a new sheet, it only copies a selected print_area from just 1 or 2 worksheets out of the whole workbook instead?

My initial plan was to have a macro to print out on one page 2 different worksheets with a selected print_area1 and print_area2.
 
Upvote 0

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top