You can use
Sheets(Array("C", "D", "F")).Visible = xlSheetHidden
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
I would like to hide specific sheets while using an if then statement when two other sheets are already hidden.
Here is what I have:
If Sheets("A").visible=False And Sheets("B").visible=False Then Sheets("C").visible=False
This will hide sheet "C" but I also want to hide sheets D, and F.
I have tried - ...Then Sheets("C,D,F").visible=False ...but I get an error
Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.
You can use
Sheets(Array("C", "D", "F")).Visible = xlSheetHidden
Hi John,
I would like to hide specific sheets while using an if then statement when two other sheets are already hidden.
Here is what I have:
If Sheets("A").visible=False And Sheets("B").visible=False Then Sheets("C").visible=False
This will hide sheet "C" but I also want to hide sheets D, and F.
I have tried - ...Then Sheets("C,D,F").visible=False ...but I get an error
Try:
Sheets(Array("C", "D")).Visible = xlSheetHidden
===
Regards,
Norman
Hi John,
I would like to hide specific sheets while using an if then statement when two other sheets are already hidden.
Here is what I have:
If Sheets("A").visible=False And Sheets("B").visible=False Then Sheets("C").visible=False
This will hide sheet "C" but I also want to hide sheets D, and F.
I have tried - ...Then Sheets("C,D,F").visible=False ...but I get an error
Try:
Sheets(Array("C", "D")).Visible = xlSheetHidden
===
Regards,
Norman
Thanks, That solved my problem
Hi John,
Thanks, That solved my problem
Thank you for your kind feedback and I am glad that you have resolved the problem.
In order to close this thread, and to assist others who may search the forum archives for a solution to a similar problem, I would ask you kindly to mark the responses from Hans and myself as Answer.
===
Regards,
Norman