86buickgn
11-18-2011, 01:00 PM
First time poster here, but I did use the search tool.
I have written a code that hides worksheets based on what cell is clicked. Now, I need to be able to hide/unhide worksheets based on the option chosen in a drop-down list.
Here is what I have:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim myPick As String
'This code go's in the List Sheet, (Sheet1) module.
'Sheet1 is the list sheet, in cells A2:A5
'The case names, like: 1st, 2nd, ...
'are in the Sheet1 List, in cells A2:A5.
'When one of these cells is selected, its case code runs.
myPick = Selection.Value
Select Case myPick
Case "1st"
'Below is the Sheet Name you want to un-hide.
Sheets("Sheet2").Visible = True
'Below are the Sheet Names you want to hide.
Sheets("Sheet3").Visible = False
Sheets("Sheet4").Visible = False
Sheets("Sheet5").Visible = False
Sheets("Sheet6").Visible = False
Sheets("Sheet7").Visible = False
Sheets("Sheet8").Visible = False
Sheets("Cameron").Visible = False
Sheets("Webco").Visible = False
Sheets("Jag").Visible = False
'Make the Sheet below active.
Sheets("Sheet2").Select
Case Else
'If any other cell selected, do nothing.
Sheets("Sheet2").Visible = False
Sheets("Sheet3").Visible = False
Sheets("Sheet4").Visible = False
Sheets("Sheet5").Visible = False
Sheets("Sheet6").Visible = False
Sheets("Sheet7").Visible = True
Sheets("Sheet8").Visible = True
Sheets("Cameron").Visible = False
Sheets("Webco").Visible = False
Sheets("Jag").Visible = False
Sheets("Sheet1").Select
Exit Sub
End Select
End Sub
What I need is for the worksheets "Cameron" and "Webco" to hide when I choose "Jag" in the drop down list.
Is this possible?
I have written a code that hides worksheets based on what cell is clicked. Now, I need to be able to hide/unhide worksheets based on the option chosen in a drop-down list.
Here is what I have:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim myPick As String
'This code go's in the List Sheet, (Sheet1) module.
'Sheet1 is the list sheet, in cells A2:A5
'The case names, like: 1st, 2nd, ...
'are in the Sheet1 List, in cells A2:A5.
'When one of these cells is selected, its case code runs.
myPick = Selection.Value
Select Case myPick
Case "1st"
'Below is the Sheet Name you want to un-hide.
Sheets("Sheet2").Visible = True
'Below are the Sheet Names you want to hide.
Sheets("Sheet3").Visible = False
Sheets("Sheet4").Visible = False
Sheets("Sheet5").Visible = False
Sheets("Sheet6").Visible = False
Sheets("Sheet7").Visible = False
Sheets("Sheet8").Visible = False
Sheets("Cameron").Visible = False
Sheets("Webco").Visible = False
Sheets("Jag").Visible = False
'Make the Sheet below active.
Sheets("Sheet2").Select
Case Else
'If any other cell selected, do nothing.
Sheets("Sheet2").Visible = False
Sheets("Sheet3").Visible = False
Sheets("Sheet4").Visible = False
Sheets("Sheet5").Visible = False
Sheets("Sheet6").Visible = False
Sheets("Sheet7").Visible = True
Sheets("Sheet8").Visible = True
Sheets("Cameron").Visible = False
Sheets("Webco").Visible = False
Sheets("Jag").Visible = False
Sheets("Sheet1").Select
Exit Sub
End Select
End Sub
What I need is for the worksheets "Cameron" and "Webco" to hide when I choose "Jag" in the drop down list.
Is this possible?