Combobox to list all Sheet Names How?

C

Corey

How can i set a Combobox displayed on a userform to list the current
workbook sheet names?


Corey....
 
C

Corey

Ok found this code, but it does not seem to popiulate the combobox with
anything though??

Private Sub ComboBox1_Click()
Dim Sh As Worksheet
Dim sVal As String
With ComboBox1
sVal = .Text
Clear
For Each Sh In ActiveWorkbook.Sheets
If Sh.Name <> "Inputs" Then
AddItem Sh.Name
End If
Next
.Value = sVal
Worksheets(.Value).Activate
End With
End Sub

Any idea's

Corey....
 
J

Jim Cone

Private Sub ComboBox1_Click()
If Len(ComboBox1.Value) Then
Worksheets(ComboBox1.Value).Activate
End If
End Sub

Private Sub ComboBox1_DropButtonClick()
Dim Sh As Worksheet
With ComboBox1
.Clear
For Each Sh In ActiveWorkbook.Sheets
If Sh.Name <> "Inputs" Then
.AddItem Sh.Name
End If
Next
End With
End Sub
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware



"Corey" <[email protected]>
wrote in message
Ok found this code, but it does not seem to popiulate the combobox with
anything though??

Private Sub ComboBox1_Click()
Dim Sh As Worksheet
Dim sVal As String
With ComboBox1
sVal = .Text
Clear
For Each Sh In ActiveWorkbook.Sheets
If Sh.Name <> "Inputs" Then
AddItem Sh.Name
End If
Next
.Value = sVal
Worksheets(.Value).Activate
End With
End Sub

Any idea's
Corey....
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top