As everyone knows, an Excel worksheet can be visible or hidden. As a matter of fact, it can be visible, hidden, or very hidden. This tutorial clarifies the difference and explains how to make a worksheet very hidden and how to view very hidden sheets. Continue reading
Comments page 2. Total comments: 52
I ran both macros. i also tried to manually change the visibility in VBA Editor but it did not work. I can type and save the changes in the file but when I add a module in VBA editor, I am not able to save it.
Thanks,
Alireza
Hi Alireza,
This may be a stupid question, but anyway - did you save the workbook as macro-enabled (.xlsm)? Though, the fact that your manual changes in the VBA editor are not saved shows that the problem in not in the macros. BTW, what error do you get on saving? Unfortunately we are unable to identify the cause remotely because we have never run into such issue.
I appreciate your quick reply. Sorry that I fogort to mention that it was about the Excel file (2013 version) that I have. I can see the list of the worksheets under the VBAProjects in VBA Editor but they are hidden. Even your VBA code that i used to unhide them did not work.
Thanks,
Alireza
Thank you for the details, Alireza!
For the sake of clarity, did you run the UnhideVeryHiddenSheets macro or UnhideAllSheets, or both?
Also, there are two more things to check:
- Is your workbook or worksheets(s) protected?
- Try to unhide your sheet manually via the VBA Editor (please see "How to unhide a very hidden worksheet by changing its Visible property"). Did it work?
Hi Svetlana,
I tried to unhide a sheet by using your VBA codes but i got the following error:
Run-time error '1004': Method 'visible' of object'_Worksheet' failed
I would like to know if there is any way to make the worksheet visible, please.
Thanks,
Alireza
Hi Alireza,
I have just downloaded a sample workbook from this post and all the macros worked fine on my machine. Please specify your Excel version and localization, which macro your where trying to run, and whether you tried to unhide a sheet in our sample workbook or in your own one?
So here is the code from a macro i created to select a sheet and hide the other sheet (used for navigating from a dashboard to individual sheets, there is a corresponding macro to go back).
Sub gotohoursturnover()
' gotohoursturnover Macro
Sheets("Home").Select
Sheets("Dashboard (Hours & Turnover)").Visible = True
Sheets("Home").Select
ActiveWindow.SelectedSheets.Visible = False
My question is how do i make this statement "ActiveWindow.SelectedSheets.Visible = False" make the sheet very hidden?
I have tried replacing the "false" with "xlSheetVeryHidden" but it just throws up an error.
Yes it may be simple but i am just working out vba lol.
Thanks
Mark
Hii there,
I am not familiar with macros,i needed a code to hide all the sheets in my workbook except the first sheet. And at the same time i want the other sheets to be opened when the user selects the buttons provided in the first sheet.
I used the following code & the sheets are getting hidden but the buttons wont take the user to next pages either.
Sub HideWorksheet()
Dim ws As Worksheet
For Each ws In ThisWorkbook.Worksheets
If ws.Name ThisWorkbook.ActiveSheet.Name Then
ws.Visible = xlSheetHidden
End If
Next ws
End Sub
Thank you.
Hi Svetlana,
this post is very useful for my goal. However, if the other (visible) sheets refer to the part of the content of this very hidden sheet (e.g. =VeryhiddenSheet!A1), then the very hidden sheet becomes unprotected, does it? Everybody else can add a new formula (=VeryhiddenSheet!A2) to get its content.
Hi Daniel,
You are absolutely right. If someone knows the name of a very hidden sheet, they can get its content with a formula. I don't know a 100% reliable way to prevent this.
Could you simply just set the worksheet as protected and have all cells that have a formula as locked and hidden in their properties. This will prevent others from seeing such formula referencing the veryhidden sheet.
The name of the very hidden sheet is visible in the VBA editor so, although locking the formula cells is a good idea, it is not 100% foolproof. If the very hidden sheet contains named ranges, the Name Manager also gives away the secret.
The following is convoluted, but you could:
- put your secret calculations in very hidden sheet #1
- use a second very hidden sheet #2 to refer only to the cells that you want the user to see
- refer to the sheet #2 cells in the visible sheet #3 that the user accesses
- go back to sheet #1 and add columns and rows to push the formula cells into obscure positions
- now add random numbers and text to the empty cells of sheet #1
- set the very hidden parameters for sheets #1 & #2
- lock the workbook structure
Even if the user finds the name of sheet #1, it is not possible to read the formulae and virtually impossible to find the real data as it is buried amongst the random stuff. Using the intermediate sheet #2 stops the user finding out where the 'good stuff' in sheet #1 is hidden.
I like this CLEVER STRATAGEM!!!
You can also be assisted in these other articles for tips and technics to shuffle and fill empty cells with useless data:
Random sort in Excel: shuffle cells, rows and columns:
https://www.ablebits.com/office-addins-blog/excel-randomize-list-random-sort/
How to fill empty cells with 0, with value above/below in Excel:
https://www.ablebits.com/office-addins-blog/fill-blanks-excel/
Hi Svetlana,
Really like the way you explain things.
Is there a way to write vba code that protects the structure of a workbook and that protects workbooks and worksheets without having a user input a password, but by using vba code in a "password = $%^&assl" type assignment statement?
Thanks for you help.
Hope you're having a great holiday season.
Sydney
How do I address the hidden sheet in VBA?
With ThisWorkbook.Worksheets("Plates")
myString = "!" & ThisWorkbook.Worksheets("Plates").Range(.Cells(2, 1), .Cells(lstrow, 3)).Address
lbxPlate.RowSource = ("Plates" & myString)
End With
lbxPlate.Selected(0) = True
Thanks for any assistance,
John G.
Hi, when i run the macro ,i get run time error and shows "method visible of object _worksheet failed". Sheets still very hidden.Help...
Hi, when I run the macro myself I get error 400 and when I download your sheet and ALT+F8 I get a Runtime error 1004. Sheets still very hidden. HELP!
Hi Lisa,
The first thought that comes to mind is that you are trying to unhide sheets in a protected workbook. To check this, please go to the Review tab > Changes group, and have a look at the Protect Workbook button. If it is highlighted, the workbook is protected, and you need to remove the protection first. For more information, please see How to unlock a protected workbook in Excel.
Hi Svetlana.
This was one of the most helpful blog with every detail. Could you tell me what are the steps to save this file with hidden sheets and send it to others without the danger of being visible. Can this sheet be protected?
Hi Tasneem,
Before saving the file, protect the Workbook structure with password: Review tab > Protect Workbook. This will prevent unhiding both hidden and very hidden sheets as well as hiding, renaming, moving, or deleting worksheets. For more information, please see How to protect a workbook in Excel.
Protecting a workbook will slow down the macros. Using interface only won't work to a protected workbook.. Thus calling a very hidden sheet without unhiding works?
I can not work with my Excel Sheet because it's protected. And many of these sheets are hidden in it, I can not unhide them ... please help me.
Share the workbook
Sir,
Required a formula if a cell contains a word in that word 4th Letter P = individual and if it C = corporate
Hi Govind,
If my understanding of the task is correct, the following formula should work a treat:
=IF(MID(A1,4,1)="p", "individual", IF(MID(A1,4,1)="c", "corporate", ""))
Thanks svetlana, for ur share. ur post have been provoked me to know something knew everyday about excel.