VBA Code to Very Hidden Worksheet

Thank you for providing this step-by-step guide, it works very well, however is there a way I can have some sheets as very hidden while using this? So that they do not show up in the list box control at all

http://vbaf1.com/q/a/how-to-hideunhide-a-set-of-worksheets-using-a-command-button-in-vb/

Top Contributor Asked on January 29, 2017 in VBA: User Forms.
Add Comment
4 Answer(s)

HI,

You can very hide the worksheets which ever you don’t want to appear in the listbox. To veryhide the workbook please use the following macro in the Module.  In the following macro it hides Sheet3 & Sheet4. You can change the below line according to your requirement in the VBA macro.

'Specify the Worksheet names which you dont want to display in the listbox
MySheets = Array("Sheet3", "Sheet4")

Instructions to use this macro.

1.Go to VBA Editor ( or Press Alt+F11)

 2. Insert module from the Insert menu.

3. Place the following code in the module.

Sub Sheets_VeryHidden()
Dim MySheets() As Variant
'Specify the Worksheet names which you dont want to display in the listbox
MySheets = Array("Sheet3", "Sheet4")
For i = LBound(MySheets) To UBound(MySheets)
Sheets(MySheets(i)).Visible = xlSheetVeryHidden
Next
End Sub

 Hope it clarifies your query.

Regards!

Expert Answered on January 29, 2017.
Add Comment

Hi

Thank you tried this, somehow not working. I am sure I am missing something on execution? My question is should i insert this code in the USERFORM by double clicking.

 

Top Contributor Answered on January 29, 2017.
Add Comment

Hi,

You can place the following VBA macro in the module and run the code once. So that it will hide the specified worksheets as veryhidden.

Sub Sheets_VeryHidden()
Dim MySheets() As Variant
'Specify the Worksheet names which you dont want to display in the listbox
MySheets = Array("Sheet3", "Sheet4")
For i = LBound(MySheets) To UBound(MySheets)
Sheets(MySheets(i)).Visible = xlSheetVeryHidden
Next
End Sub

Screenshot:

Here is the screenshot for your reference.

VeryHidden Worksheets

Hope it clarifies your query.

Regards!

 

Expert Answered on January 29, 2017.

Hi Valli sir,

Thank you so much for your help but it is still the same. I have attached the screen shots

RE: VBA Code to Very Hidden WorksheetModule_Screen

RE: VBA Code to Very Hidden WorksheetOutput_Screen

Will be grateful for your help.

Pranab

 

 

on January 29, 2017.
Add Comment

HI,

Please follow the below instructions.

  1.  Run ‘Sheets_VeryHidden’ procedure.
  2. Now, click on shape which is on Worksheet to display userform.

Still if you have problem please send your macro file at info@analysistabs.com . I will fix your issue and will resend it to you.

Regards!

Expert Answered on February 2, 2017.
Add Comment
  • Found this useful?

    Please share using the share button above.

    If you found the answer is best answer for your question, Please mark as 'best answer' by clicking on the right tick mark icon at the left side of the answer.

    Found the answer useful and wants to credit the user, then vote the answer (vote up).

  • Your Answer

    By posting your answer, you agree to the privacy policy and terms of service.