PDA

View Full Version : Solved: display worksheets in combo box except...



av8tordude
03-29-2011, 09:03 PM
I have 6 worksheets (Security, Master, Sheet1, Sheet2, Sheet3, f2106). I only want to display Master, Sheet1, Sheet2, Sheet3 in a combo box only.

Sheets Security & f2106 should not display in combo box. I found this code that displays all sheets except "master" in the combo box, but can't figure out how to edit it to fit my needs.

Dim Sh As Worksheet

With cboYear
.Clear
For Each Sh In ActiveWorkbook.Sheets
If Sh.Name <> "Master" Or Sh.Name <> "Security" Then
.AddItem Sh.Name
End If
Next
End With

av8tordude
03-29-2011, 09:18 PM
I figure it out. thnks

Private Sub cboYear_Enter()
Dim Sh As Worksheet

With cboYear
For Each Sh In ActiveWorkbook.Sheets
If ((Sh.Name <> "Security") And (Sh.Name <> "f2106")) Then
.AddItem Sh.Name
End If
Next
End With
End Sub