New Excel Forum

This forum has been moved to TeachExcel.com

Ask all future questions in the New Excel Forum.

ExcelKey

How to hide sheets conditionally based on cell value

Macros, VBA, Excel Automation, etc.

How to hide sheets conditionally based on cell value

Postby masud_jahan » Wed May 25, 2016 10:02 am

I'm looking for code that will hide one or more worksheets based on a cell value in Sheet1. For example if cell A2 (in Sheet1) = 2, then hide Sheet5 and Sheet6; again if A2 = 3, then hide Sheet6.

I'm a newbie and have been trying for the code for last few days but failed. So I'm looking for help from experts here.

Thanks in advance.
  • 0

masud_jahan
Rookie
 
Posts: 1
Joined: May 25, 2016
Reputation: 0
Excel Version: 2010

Re: How to hide sheets conditionally based on cell value

Postby charles » Sat Jul 09, 2016 1:47 pm

Hi,

At what point in time do you want to hide the sheets?
You can use a "Workbook" event to hide the sheets when you add a "2" in the specified address.
Here is a sample of the code. See if you can modify it to your needs.

Charles
  • 0

You do not have the required permissions to view the files attached to this post.
There are other ways too do this but...

Be kind let us know if you posted somewhere else!



Charles
charles
Excel Badass
 
Posts: 632
Joined: Dec 10, 2011
Location: Mississippi
Reputation: 1
Excel Version: Excel 2003, 2007 and Mac 2011

Re: How to hide sheets conditionally based on cell value

Postby charles » Sat Jul 16, 2016 12:34 pm

  • 0

There are other ways too do this but...

Be kind let us know if you posted somewhere else!



Charles
charles
Excel Badass
 
Posts: 632
Joined: Dec 10, 2011
Location: Mississippi
Reputation: 1
Excel Version: Excel 2003, 2007 and Mac 2011


Return to Macros and VBA Questions

Who is online

Users browsing this forum: No registered users and 3 guests

cron