Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / September 2007

Tip: Looking for answers? Try searching our database.

Selective Worksheet printing

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Colin Telfer - 16 Sep 2007 10:45 GMT
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
Zone - 16 Sep 2007 13:30 GMT
Colin, do you mean you want the routine to determine which worksheets are
empty and print only those worksheets that are not empty?  James

> 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,
[quoted text clipped - 3 lines]
>
> Colin
Zone - 16 Sep 2007 16:38 GMT
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

> Colin, do you mean you want the routine to determine which worksheets are
> empty and print only those worksheets that are not empty?  James
[quoted text clipped - 7 lines]
>>
>> Colin
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.