mmn1000
Board Regular
- Joined
- Mar 17, 2020
- Messages
- 78
- Office Version
- 2019
- 2013
- Platform
- Windows
Hello
In an Excel file that has several sheets, there is a ComboBox in each of the sheets.
I created a sheet list with the code below
By selecting the name of the sheet from the ComboBox, we go to the desired sheet
How can I hide other sheets by selecting the name of the sheet and going to the desired sheet?
For this, I used the following code, but it did not work correctly
Please help me how to do this
In an Excel file that has several sheets, there is a ComboBox in each of the sheets.
I created a sheet list with the code below
VBA Code:
Private Sub Worksheet_Activate()
ComboBox1.Clear
For wsheet = 1 To Sheets.Count
ComboBox1.AddItem Sheets(wsheet).Name
Next
End Sub
By selecting the name of the sheet from the ComboBox, we go to the desired sheet
VBA Code:
Private Sub ComboBox1_Change()
If Not ComboBox1.Text = "" Then
Sheets(ComboBox1.Text).Select
End If
End Sub
For this, I used the following code, but it did not work correctly
VBA Code:
Private Sub ComboBox1_Change()
Sheets("Sheet1").Select
ActiveWindow.SelectedSheets.Visible = False
If Not ComboBox1.Text = "" Then
Sheets(ComboBox1.Text).Visible = True
Sheets(ComboBox1.Text).Select
End If
End Sub
Please help me how to do this