SeverusGrape
New Member
- Joined
- Dec 29, 2022
- Messages
- 1
- Office Version
- 365
- Platform
- Windows
Hi, first time poster here and rookie Excel user.
I have a very simple bit of code to select which worksheet will be active from a combo box.
I want to exclude specific worksheets from that combo box.
The idea, basically, is to have a different worksheet for each week of the year. This is for rostering. But rather than having a long string of worksheets to select from on the tab section, I want to hide the weekly sheets and select the work week from the combo box instead. That way I can have the other few worksheets I'll be using on this workbook to select from on the tab section without all the date worksheets cluttering it up.
Any help is appreciated. Thanks in advance.
My code for the combo box, to select a worksheet is...
I have a very simple bit of code to select which worksheet will be active from a combo box.
I want to exclude specific worksheets from that combo box.
The idea, basically, is to have a different worksheet for each week of the year. This is for rostering. But rather than having a long string of worksheets to select from on the tab section, I want to hide the weekly sheets and select the work week from the combo box instead. That way I can have the other few worksheets I'll be using on this workbook to select from on the tab section without all the date worksheets cluttering it up.
Any help is appreciated. Thanks in advance.
My code for the combo box, to select a worksheet is...
VBA Code:
Private Sub cboStart_Change()
If cboStart <> "Choose Sheet" Then
Worksheets(cboStart.Value).Select
End If
cboStart.Value = "Choose Sheet"
End Sub
Private Sub Worksheet_Activate()
Dim sht As Worksheet
Me.cboStart.Clear
For Each sht In ThisWorkbook.Worksheets
Me.cboStart.AddItem sht.name
Next sht
End Sub