The information in this article applies to:
SUMMARYIn Microsoft Excel, you can hide sheets in a workbook so that a user cannot see them. You can hide any sheet type in a workbook, but you must always leave at least one sheet visible. MORE INFORMATIONHiding a Sheet Using Menu CommandsTo hide a sheet, point to Sheet on the Format menu, and then click Hide. To unhide a sheet, point to Sheet on the Format menu, and then click Unhide.NOTE: For module sheets in Microsoft Excel 5.0 and 7.0, point to Sheet on the Edit menu, and click Hide or Unhide. You cannot hide or unhide module sheets in Microsoft Excel 97 and Microsoft Excel 98 Macintosh Edition, because they appear in the Visual Basic Editor. Hiding a Sheet with a Visual Basic MacroYou can also hide or unhide a sheet using a Microsoft Visual Basic for Applications macro or procedure. When you use Visual Basic code, you can use the xlVeryHidden property to hide a sheet and keep the Unhide dialog box from listing it. When you do this, the only way to make the sheet visible again is to create another Visual Basic macro.In a Visual Basic macro, use the Visible property to hide or unhide a sheet. You can set the Visible property to True, False, or xlVeryHidden. True and False have the same effect as using the Unhide or Hide menu commands. The xlVeryHidden argument hides the sheet and also keeps the Unhide dialog box from displaying it. Sample Visual Basic Code for All VersionsMicrosoft 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 a Microsoft Certified Solution Provider or the Microsoft fee-based consulting line at (800) 936-5200. For more information about Microsoft Certified Solution Providers, please see the following page on the World Wide Web:http://www.microsoft.com/mcsp/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/overview/overview.aspThe following samples show you how to use the Visible property of a Sheet object.
Sample Visual Basic Code for Versions 5.0 and 7.0NOTE: You cannot hide or unhide module sheets in Microsoft Excel 97 or Microsoft Excel 98 Macintosh Edition.
REFERENCESFor additional information, please click the article numbers below to view the articles in the Microsoft Knowledge Base: Q156879 XL97: Visual Basic Modules Cannot Be Hidden or Protected Additional query words: 8.00 XL98 XL97 XL7 XL5
Keywords : kbprg kbdta kbdtacode PgmHowto KbVBA |
Last Reviewed: November 11, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |