Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 38
Default Hide or unhide sheets based on cell

Would someone be able to provide a suggestion as to how to hide and / or
unhide a group of sheets based on a cell content?
I have a cell that selects a model from a drop down list; I would like to
hide all the sheets not related to this value.
When the value changes, I would like the corresponding sheets to be
un-hidden, and the non-related sheets to go away.
There will be certain sheets that will be visible at all times.

Is this possible?

Thanks
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,123
Default Hide or unhide sheets based on cell

This basic example will give you a start

You can copy this event in the sheet module of Sheet1 for example

If you enter 1 in A1 it hide sheet2 and sheet3
If A1 = 2 it unhide them

Private Sub Worksheet_Change(ByVal Target As Range)
Dim sh As Worksheet
If Not Application.Intersect(Range("A1"), Target) Is Nothing Then
For Each sh In Sheets(Array("Sheet2", "Sheet3"))
If Target.Value = 1 Then sh.Visible = xlSheetHidden
If Target.Value = 2 Then sh.Visible = xlSheetVisible
Next sh
End If
End Sub


--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"billinr" wrote in message ...
Would someone be able to provide a suggestion as to how to hide and / or
unhide a group of sheets based on a cell content?
I have a cell that selects a model from a drop down list; I would like to
hide all the sheets not related to this value.
When the value changes, I would like the corresponding sheets to be
un-hidden, and the non-related sheets to go away.
There will be certain sheets that will be visible at all times.

Is this possible?

Thanks

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 38
Default Hide or unhide sheets based on cell

Thanks, Ron.
This is what I needed.


Regards

"Ron de Bruin" wrote:

This basic example will give you a start

You can copy this event in the sheet module of Sheet1 for example

If you enter 1 in A1 it hide sheet2 and sheet3
If A1 = 2 it unhide them

Private Sub Worksheet_Change(ByVal Target As Range)
Dim sh As Worksheet
If Not Application.Intersect(Range("A1"), Target) Is Nothing Then
For Each sh In Sheets(Array("Sheet2", "Sheet3"))
If Target.Value = 1 Then sh.Visible = xlSheetHidden
If Target.Value = 2 Then sh.Visible = xlSheetVisible
Next sh
End If
End Sub


--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"billinr" wrote in message ...
Would someone be able to provide a suggestion as to how to hide and / or
unhide a group of sheets based on a cell content?
I have a cell that selects a model from a drop down list; I would like to
hide all the sheets not related to this value.
When the value changes, I would like the corresponding sheets to be
un-hidden, and the non-related sheets to go away.
There will be certain sheets that will be visible at all times.

Is this possible?

Thanks


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
hide/unhide brownti Excel Discussion (Misc queries) 3 February 6th 07 07:14 PM
Hide sheets based on Cell value Mike Milmoe Excel Discussion (Misc queries) 4 January 16th 07 05:57 AM
Macro to hide and unhide based on criteria [email protected] Excel Discussion (Misc queries) 1 June 5th 06 08:05 PM
Hide Unhide Colin Excel Discussion (Misc queries) 4 April 9th 06 05:01 PM
Is there a way to HIDE a row based on a value of a cell ? Reddiance Excel Discussion (Misc queries) 4 January 26th 05 02:57 AM


All times are GMT +1. The time now is 03:22 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"