ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Combobox to list all Sheet Names How? (https://www.excelbanter.com/excel-programming/377804-combobox-list-all-sheet-names-how.html)

Corey

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


Corey....



Corey

Combobox to list all Sheet Names How?
 
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....



Jim Cone

Combobox to list all Sheet Names How?
 
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"
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....



Corey

Combobox to list all Sheet Names How?
 
Thank you Jim.
Perfectly done....


ctm
"Jim Cone" wrote in message
...
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"
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....






All times are GMT +1. The time now is 09:19 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com