tbrynard01
Board Regular
- Joined
- Sep 20, 2017
- Messages
- 129
- Office Version
- 365
- Platform
- Windows
Hi,
I have a sheet that has a bunch of sheets, created a menu sheet with a drop down to unhide all but the specific sheet, but its not working correctly, this is the code on a test one that I created as a practice workbook - I'm not sure where I'm going wrong. It works if I only have one sheet. Or is there a better way to do this.
I have a drop down on the Menu Worksheet that lists all the sheets in the workbook and a table with the sheet names in another worksheet that i keep hidden. This Excel knowledge of users that will use that file is not high so am trying to make it as easy as possible.
Thank you.
Private Sub Worksheet_Change(ByVal Target As Range)
If [MenuOption] = "Sheet 1" Then
Sheets("Sheet2").Visible = False
Sheets("Sheet3").Visible = False
Sheets("Sheet4").Visible = False
Else
Sheets("Sheet2").Visible = True
Sheets("Sheet3").Visible = True
Sheets("Sheet4").Visible = True
End If
If [MenuOption] = "Sheet 2" Then
Sheets("Sheet1").Visible = False
Sheets("Sheet3").Visible = False
Sheets("Sheet4").Visible = False
Else
Sheets("Sheet1").Visible = True
Sheets("Sheet3").Visible = True
Sheets("Sheet4").Visible = True
End If
If [MenuOption] = "Sheet 3" Then
Sheets("Sheet1").Visible = False
Sheets("Sheet2").Visible = False
Sheets("Sheet4").Visible = False
Else
Sheets("Sheet1").Visible = True
Sheets("Sheet2").Visible = True
Sheets("Sheet4").Visible = True
End If
If [MenuOption] = "Sheet 4" Then
Sheets("Sheet1").Visible = False
Sheets("Sheet2").Visible = False
Sheets("Sheet3").Visible = False
Else
Sheets("Sheet1").Visible = True
Sheets("Sheet2").Visible = True
Sheets("Sheet3").Visible = True
End If
Sheets("Menu").Select
Cells(2, 1).Select
End Sub
I have a sheet that has a bunch of sheets, created a menu sheet with a drop down to unhide all but the specific sheet, but its not working correctly, this is the code on a test one that I created as a practice workbook - I'm not sure where I'm going wrong. It works if I only have one sheet. Or is there a better way to do this.
I have a drop down on the Menu Worksheet that lists all the sheets in the workbook and a table with the sheet names in another worksheet that i keep hidden. This Excel knowledge of users that will use that file is not high so am trying to make it as easy as possible.
Thank you.
Private Sub Worksheet_Change(ByVal Target As Range)
If [MenuOption] = "Sheet 1" Then
Sheets("Sheet2").Visible = False
Sheets("Sheet3").Visible = False
Sheets("Sheet4").Visible = False
Else
Sheets("Sheet2").Visible = True
Sheets("Sheet3").Visible = True
Sheets("Sheet4").Visible = True
End If
If [MenuOption] = "Sheet 2" Then
Sheets("Sheet1").Visible = False
Sheets("Sheet3").Visible = False
Sheets("Sheet4").Visible = False
Else
Sheets("Sheet1").Visible = True
Sheets("Sheet3").Visible = True
Sheets("Sheet4").Visible = True
End If
If [MenuOption] = "Sheet 3" Then
Sheets("Sheet1").Visible = False
Sheets("Sheet2").Visible = False
Sheets("Sheet4").Visible = False
Else
Sheets("Sheet1").Visible = True
Sheets("Sheet2").Visible = True
Sheets("Sheet4").Visible = True
End If
If [MenuOption] = "Sheet 4" Then
Sheets("Sheet1").Visible = False
Sheets("Sheet2").Visible = False
Sheets("Sheet3").Visible = False
Else
Sheets("Sheet1").Visible = True
Sheets("Sheet2").Visible = True
Sheets("Sheet3").Visible = True
End If
Sheets("Menu").Select
Cells(2, 1).Select
End Sub