Posts Tagged ‘hide sheets in excel vba’

2 Ways to Hide or Unhide Worksheet in Excel 2016 / 2013 / 2010 / 2007

December 14th, 2016 by Admin

Is there a way to prevent others from viewing a sheet in an Excel workbook? If you don’t want people to change data or formula in a cell, you can hide the sheet. But this shouldn’t be used as a security measure. In this tutorial we’ll show you 2 ways to hide / unhide worksheet in Excel 2016 / 2013 / 2010 / 2007.

Note: Excel doesn’t let you hide all sheets in a workbook. At least one has to be displayed.

Method 1: Hide/Unhide Excel Worksheet with GUI

  1. Right-click on the worksheet you want to hide, select Hide from the pop-up menu. Your worksheet will no longer be visible, however, the data contained in a hidden worksheet can still be referenced on other worksheets.

    hide-sheet

  2. To unhide a worksheet, just right-click on any visible worksheet and select Unhide.

    unhide-sheet

  3. In the Unhide dialog box, you can see all of the currently hidden sheets in the list box. Select a sheet you want to unhide and click OK.

    excel-hidden-sheets

Method 2: Hide/Unhide Excel Worksheet with VBA

Excel has a more secure setting known as “Very Hidden”. A very hidden worksheet can’t be unhidden using the Excel user interface because it doesn’t appear in the Unhide dialog box. Here’s how to hide / unhide a worksheet with VBA editor:

  1. To open the VBA editor, press the Alt+F11 keyboard shortcut, or right-click on any worksheet and select View Code.

    excel-view-code

  2. From the Project window in the upper left pane, you can see all hidden and visible sheets in your workbook. Select a sheet you want to hide.
  3. In the lower left pane, you can see all properties of your selected worksheet. In the Visible drop-down list, select xlSheetVeryHidden.

    xlSheetVeryHidden

  4. Close the VBA editor. Your worksheet will no longer be visible. When the Very Hidden attribute is set on a worksheet, the Hide option is greyed out.

    excel-unhide-greyed

  5. Very hidden sheets can only be made visible through the VBA editor. If you want to unhide a very hidden sheet, open the VBA editor and change the Visible attribute back to xlSheetVisible.