Printing Entire Workbook Prints Hidden Sheets (136261)



The information in this article applies to:

  • Microsoft Excel for Windows 95
  • Microsoft Excel for Windows 5.0c
  • Microsoft Excel for Windows NT 5.0
  • Microsoft Excel for the Macintosh 5.0a

This article was previously published under Q136261

SUMMARY

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. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers 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 requirements.

Sample Visual Basic Procedure

   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
				

MORE INFORMATION

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.

Modification Type:MinorLast Reviewed:10/11/2006
Keywords:kbcode kbinfo kbprint kbProgramming KB136261