Question posted 2009 · +19 upvotes
I have an Excel spreadsheet with three sheets. One of the sheets contains formulas for one of the other sheets.
Is there is a way of hiding it that sheet pprogrammatically, which contains these formulas?
Accepted answer +33 upvotes
To hide from the UI, use Format > Sheet > Hide
To hide programatically, use the Visible property of the Worksheet object. If you do it programatically, you can set the sheet as “very hidden”, which means it cannot be unhidden through the UI.
ActiveWorkbook.Sheets("Name").Visible = xlSheetVeryHidden
' or xlSheetHidden or xlSheetVisible
You can also set the Visible property through the properties pane for the worksheet in the VBA IDE (ALT+F11).
Excel VBA objects referenced (4)
ActiveWorkbook.Sheets— Using ActiveX Controls on SheetsActiveWorkbook.Sheets— Workbooks and WorksheetsWorksheet— Refer to All the Cells on the WorksheetWorksheet— List of worksheet functions available to Visual Basic
Top excel-vba Q&A (6)
- How to clear the entire array? +58 (2010)
- How to change Format of a Cell to Text using VBA +55 (2011)
- Download attachment from Outlook and Open in Excel +43 (2012)
- Can a VBA function in Excel return a range? +36 (2009)
- 2 Dimensional array from range +34 (2013)
- How do I slice an array in Excel VBA? +31 (2008)
excel-vba solutions on this site
— top 4%.