Selective Worksheet printing

  • Thread starter Thread starter Colin Telfer
  • Start date Start date
C

Colin Telfer

Does anyone have any routines available which will allow one to print off
worksheets in a spreadsheet which have entries in them, e.g. worksheets 1,
4, and 5 will have data in whereas 2 and 3 are empty?

Thanks in advance

Colin
 
Colin, do you mean you want the routine to determine which worksheets are
empty and print only those worksheets that are not empty? James
 
Colin, copy the following code and paste it in a standard module. It
determines which worksheets contain data and prints them, skipping the ones
without data. Note that it is only concerned with the active workbook and
only looks for cell data. It does not look for things such as formatting
and comments. HTH, James

Sub PrintNonEmpty()
'prints all non-empty worksheets in active workbook
Dim ws As Worksheet
For Each ws In ActiveWorkbook.Worksheets
ws.Activate
If WorksheetFunction.CountA(Cells) <> 0 _
Then ws.PrintOut
Next ws
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top