Sometimes you may want to print several worksheets within a workbook. Of course you could simply select each worksheet one at a time and print them, however, using this facilty you can select multiple worksheets to print and print them in one operation.

A full working copy of a workbook that utilises this technique can be found here

In order to implement this process you will need to have 2 Userforms and 1 Function defined.

There will also be a requirement to code a statement for when the Workbook is initially opened.

All the required coding and userforms are available by following the appropriate links below.

Enjoy!

As normal the usual disclaimers apply.

 
 
  Activate the Developer Tab  
  The first step is to activate the developer tab in Excel if it isn't already there.

There are two ways of achieving this.

If you want to permanently have the developer tab available you can do this by following the directions in the video alongside.

The other method is to press "ALT"+"F11" at the same time. Remember that your keyboard may also require you to press the "fn" key also.

Either of these methods should open the "Developer" screen.
 
 
 
  Download the Zip file Containing the Userforms  
 

The Zip file containing the Userforms
(ListSheets & frmPrint) is available from here

The first thing to do is to import the userform Zip file that is linked to on the left.

Once it is downloaded and saved, extract the files ready for importing into your workbook.
 
 
 
  Add the Required Function  
 

ColumnEmpty is available from here

There is 1 function that is required to be coded for the facility to work. This is named ColumnEmpty

ColumnEmpty is available for download from the link on the left. It is used to identify if a worksheet column is empty or not.
 
 
 
  Add Code To Show Userform When Workbook is Opened  
  Private Sub Workbook_Open()
frmPrint.Show vbApplicationModal
End Sub
In order that the 'Print' userform (frmPrint) is shown when the workbook opens you will need to add the code alongside to the ThisWorkbook Excel Objects in the developer window.  
 
 
  Demonstration of Printing Worksheets  
  Alongside is a video demonstration of our free working example of printing worksheets

The full working example of this workbook is available from here
 
 
 
  Usage Instructions  
 
The print facility allows a user to print multiple worksheets in one operation.

When it is correctly implemented it will show userforms which are modal and will stay on top of the current worksheet. They can be dragged and dropped within the window if needed.

This facility will print hidden worksheets, but will not print very hidden worksheets.

An example of the "Print Form" is:

Picture of the frmPrint Form


The frmPrint userform is coded in such a away that it cannot be closed. If you need to give it the abilty to be closed then you need to remove the UserForm_QueryClose subroutine from the frmPrint userform.

When you click the 'Print' button you will see the ListSheets userform. This looks like:

ListSheets userform

From this form you can select one or more worksheets to be printed. Use the 'ctrl' and/or 'shift' keys in the usual way to select worksheets to be printed.

The checkboxes allow you to specify if the output should be printed in landscape (the default is Portrait). It should also be noted that the print will attempt to print a worksheet on one page.

You can have the facility hide empty rows and/or columns. These will be restored after printing.

You can have the facility generate headers and footer. These will be kept after printing so you may want to delete them if they are not wanted.

After printing you will be returned to the worksheet that you were on before printing.
 
 
 

That is all there is to it.

 
 


If you need any support or assistance with any of the code on this site
or
if you would like to contact us, please click here

follow us on facebook
Follow us on Facebook

 

Number of unique visitors 433

Copyright © Abbydale Systems LLC 2015-2024

Abbydale Systems LLC Lic. 802696149. All rights reserved.

Last modified : Monday 7th of November 2022