Lee Rabbit
New Member
- Joined
- Apr 30, 2020
- Messages
- 43
- Office Version
- 2010
- Platform
- Windows
I am a bit stumped as I am still learning.
I have the following code in the first sheet of my workbook. The sheet is named "MASTER SHEET". I have populated both the ListBox & ComboBox with all sheets but I do not wish to have the "MASTER SHEET" displayed as a selectable option.
I have tinkered as best I can before posting here as I really did want to resolve the issue myself but everything I have tried thus far has resulted in errors.
I am sure the answer is staring me in the face as I believe I will need something like this.....
I guess it's the code placement that is baffling me.
A big thanks in advance to anyone who can steer me in the right direction.
Regards,
Lee
I have the following code in the first sheet of my workbook. The sheet is named "MASTER SHEET". I have populated both the ListBox & ComboBox with all sheets but I do not wish to have the "MASTER SHEET" displayed as a selectable option.
VBA Code:
Private Sub Worksheet_Activate()
Dim sh As Worksheet
Me.SelectDriver.Clear
For Each sh In ThisWorkbook.Worksheets
Me.SelectDriver.AddItem sh.NAME
Next sh
Me.ListBoxSh.Clear
For Each sh In ThisWorkbook.Worksheets
Me.ListBoxSh.AddItem sh.NAME
Next sh
End Sub
I have tinkered as best I can before posting here as I really did want to resolve the issue myself but everything I have tried thus far has resulted in errors.
I am sure the answer is staring me in the face as I believe I will need something like this.....
VBA Code:
For i = 2 To Sheets.Count
If Sheets(i).Name Like "MASTER SHEET" Then
I guess it's the code placement that is baffling me.
A big thanks in advance to anyone who can steer me in the right direction.
Regards,
Lee