View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.misc
Daniel.C[_3_] Daniel.C[_3_] is offline
external usenet poster
 
Posts: 133
Default Exclude Worksheets from Combo Box?

Hi.
Try :

Private Sub UserForm_Initialize()
Dim WS As Worksheet, Exclusion
Exclusion = Array("Sheet1", "Sheet2")
For Each WS In Worksheets
If Not IsNumeric(Application.Match(WS.Name, Exclusion, 0)) Then
ComboBox1.AddItem WS.Name
End If
Next
End Sub

Regards.
Daniel

Hi,

The following code was very helpful. Is there any way to exclude certain
Worksheets from being in the Combo Box?


Private Sub UserForm_Initialize()
Dim WS As Worksheet
For Each WS In Worksheets
ComboBox1.AddItem WS.Name
Next
End Sub

Private Sub ComboBox1_Change()
If ComboBox1.Text = "" Then
Exit Sub
End If
Worksheets(ComboBox1.Text).Activate
Unload Me
End Sub