Display Sheet when Data is in a Cell

aggiemarine07

New Member
Joined
Nov 5, 2013
Messages
46
Howdy!

I have an interesting excel question for yall. I searched google and couldnt find the answer (maybe I was phrasing it wrong), but I was wondering is it possible have a sheet un-hide when data appears in certain cell or hide it when data isnt in a certain cell?

Heres an example. I currently have a workbook with multiple tabs on it showing data for people within those groups. It is broken out as follows:
Tab1 (header sheet) - contains each group name in four different cells (cells A1,A2,A3,A4)
Tab2 (Group1) - contains a bunch of personal information about its members
Tab3 (Group2) - contains a bunch of personal information about its members
Tab4 (Group3) - contains a bunch of personal information about its members
Tab5 (Group4) - contains a bunch of personal information about its members

What I would like to do is use some sort of VBA/Macro that hides tab4 when we only have three groups or hides tabs 4 and 5 if only 2 groups. I would like to do this whenever I enter the group name in tab1 since they change every month or so. Is that possible? Thanks for all yalls help in advance!
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
this does the trick

Code:
If Sheets(1).Cells(1, 1).Value <> "Group2" Then Sheets(2).Visible = False

it can be within Workshhet_change event to called automatically
 
Upvote 0
this does the trick

Code:
If Sheets(1).Cells(1, 1).Value <> "Group2" Then Sheets(2).Visible = False

it can be within Workshhet_change event to called automatically


Awesome, I'll give this a shot when i get into work tomorrow and let you know it works.

Just a quick question though, would this go in just Tab1 or do I need to put it in every tab?
 
Upvote 0
Im not sure what are you trying to achieve. Can't you just filter the data on one sheet (by tabs you refer to sheets, right?)
This code will go just to sheet 1 and it hides the sheet from user.
 
Upvote 0
Im not sure what are you trying to achieve. Can't you just filter the data on one sheet (by tabs you refer to sheets, right?)
This code will go just to sheet 1 and it hides the sheet from user.

Yes, sheet = tab

I think the code you gave me will hide the sheet if a value registers in a certain cell (a1 for example) right?
 
Upvote 0

Forum statistics

Threads
1,223,908
Messages
6,175,305
Members
452,633
Latest member
DougMo

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top