hide or unhide worksheets based on cells in another sheet

miconian

Well-known Member
Joined
Aug 18, 2004
Messages
769
Hi gurus,

Let's say that I have one worksheet that is never hidden, and on that worksheet I have a column called "fruit." Then I have three hidden worksheets: the apple worksheet, the pear worksheet, and the orange worksheet.

Well, if "apple" occurs anywhere in the fruit column on the main worksheet, then I want the apple worksheet to be visible. If not, then I want it hidden. Ditto for pear and orange.

What think you?
 
Re: hide or unhide worksheets based on cells in another shee

...hm. On further testing, doesn't work as well as I thought. I guess the worksheet doesn't calculate after a mere change in text in a single cell.
 
Upvote 0

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
Re: hide or unhide worksheets based on cells in another shee

I've got it working ok by using both worksheet_activate and worksheet_change.

A lingering question: What if I want to check more than one column? Can I say something equivalent to

Code:
With Columns ("A:A") and ("R:R")
?
 
Upvote 0
Re: hide or unhide worksheets based on cells in another shee

To clarify: The issue is that there is one worksheet which actually corresponds to about nine different possible entries in column A. So, you have helped me to say "If column A contains 'apples,' then show the apple worksheet. If column A contains 'pears,' then show the pear worksheet."
Now, I want to add:
"If column A contains 'granite,' limestone,' 'coal,' or 'quartz,' then show the rock worksheet."

Two factors that may or may not make this task easier. One: column R now shows 'rock' on every row in which column A shows a particular rock. Two: There is a range on 'Sheet 2' listing all the rocks.
 
Upvote 0

Forum statistics

Threads
1,216,084
Messages
6,128,722
Members
449,465
Latest member
TAKLAM

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