Show Written by Allen Wyatt (last updated August 22, 2019) Macros are often used to process information within a workbook. Your macro can access any cells in the workbook, unless the worksheet containing the cell is hidden. When you hide a worksheet, it is even hidden from normal macro operations. The upshot of this is that if you want to run a macro and have it access information on a hidden worksheet, you must first "unhide" the worksheet. To do this, you use the following line of code in your macro: Sheets("My Hidden Sheet").Visible = True When this line is executed, then the worksheet named My Hidden Sheet will no longer be hidden. It is then easily accessible by using the Selection object or the Select method. When you are later ready to hide the worksheet again (when you are done processing), use this line of code: Sheets("My Hidden Sheet").Visible = False Of course, unhiding and later hiding worksheets can cause a lot of flashing on the screen as Excel tries to update its screen display based on the commands executed in your macro. If you want to avoid this, then use the following line of code at the beginning of your macro: Application.ScreenUpdating = False With screen updating turned off in this way, nobody will ever know that you unhid a worksheet and later rehid it. Make sure that before ending the macro, however, you set the ScreenUpdating property back to True. Remember, as well, that the Selection object (and the Select method) are not the only ways to access information. If you rely, instead, on working with ranges (using the Range method or defining an object using the Range method), then you can easily access information on a hidden worksheet without the need to make it visible. If you would like to know how to use the macros described on this page (or on any other page on the ExcelTips sites), I've prepared a special page that includes helpful information. Click here to open that special page in a new browser tab. ExcelTips is your source for cost-effective Microsoft Excel training. This tip (2548) applies to Microsoft Excel 97, 2000, 2002, and 2003. You can find a version of this tip for the ribbon interface of Excel (Excel 2007 and later) here: Running Macros on Hidden Worksheets. Author BioWith more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He is president of Sharon Parq Associates, a computer and publishing services company. Learn more about Allen... MORE FROM ALLENUsing the INT Worksheet Function The INT function allows you to convert a value to an integer. The effect the function has depends on the characteristics ... Discover More Determining Combinations to Make a Total If you have a range of cells that contain values, you may wonder which combinations of those cells should be used to meet ... Discover More IEEE Citation Format Different style guides describe different ways of formatting information that appears in a document. One such style guide ... Discover More Skip to main content This browser is no longer supported. Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
In this articleSummaryIn Microsoft Excel, you can hide sheets in a workbook so that a user cannot see them. You can hide any type of sheet 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. Select the appropriate sheet and then click OK. Note You cannot hide module sheets 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 CodeMicrosoft 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.The following samples show you how to use the Visible property of a Sheet object.
The following sample illustrates how to use the xlVeryHidden argument of the Visible property to hide a worksheet:
Can you select a hidden sheet VBA?The only way to access a Very Hidden sheet is to go into the VBA Editor (Alt + F11). On the top left hand side of the screen, you'll see the Project Explorer. In here, you'll see different files and add-ins that you have open, along with the relevant objects that they're made up of.
Can you reference a hidden sheet in Excel?You can hide any worksheet to remove it from view. The data in hidden worksheets is not visible, but it can still be referenced from other worksheets and workbooks, and you can easily unhide hidden worksheets as needed. Right-click the sheet tab you want to hide, or any visible sheet if you want to unhide sheets.
|