ID: Q136261
The information in this article applies to:
In Microsoft Excel, if you print the entire workbook, all sheets are printed, including hidden sheets. This feature allows you to print hidden sheets without having to unhide and then re-hide them.
If you do not want to print all sheets, use any of the following methods.
Method 1: Manually select all the sheets that you want to print either by
pressing CTRL and clicking the desired sheet tabs or by
clicking the first sheet tab and pressing SHIFT and clicking on
the last sheet tab to select all the sheets in between. On the
File menu, click Print. Click the Selected Sheets option
Method 2: Use the following macro to print all of the visible sheets in
the workbook.
Microsoft provides programming examples for illustration only, without
warranty either expressed or implied, including, but not limited to, the
implied warranties of merchantability and/or fitness for a particular
purpose. This article assumes that you are familiar with the programming
language being demonstrated and the tools used to create and debug
procedures. Microsoft support professionals can help explain the functionality
of a particular procedure, but they will not modify these examples to
provide added functionality or construct procedures to meet your specific
needs. If you have limited programming experience, you may want to contact
the Microsoft fee-based consulting line at (800) 936-5200. For more
information about the support options available from Microsoft, please see
the following page on the World Wide Web:
http://www.microsoft.com/support/supportnet/refguide/
Sub Print_Visible_Sheets()
Dim sht
' Turn off the screen redraw.
Application.ScreenUpdating = False
' Loop through for all sheets in the workbook.
For Each sht In Sheets
' If the current sheet is visible, then group it with the rest.
If sht.Visible Then sht.Select Replace:=False
Next
' Print all of the selected sheets.
ActiveWindow.SelectedSheets.PrintOut copies:=1
' Ungroup the sheets.
ActiveSheet.Select
' Turn back on the screen redraw.
Application.ScreenUpdating = True
End Sub
This behavior is by design of Microsoft Excel.
Note that hiding a sheet is not a true form of document protection, because the sheet can be unhidden through the menu and there is no mechanism to keep someone from linking to or copying from a hidden sheet. One reason to use hidden sheets is to keep workbooks from becoming too cluttered.
Additional query words: 5.00 5.00c 7.00
Keywords : kbcode kbprg kbprint PgmOthr xlprint
Version : WINDOWS:5.0,5.0c,7.0; MACINTOSH:5.0,5.0a
Platform : MACINTOSH WINDOWS
Issue type : kbinfo
Last Reviewed: May 17, 1999