Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
The code below list all the sheets name of active workbook in drop
down list. Because of the code line ".CLEAR" I am not able to get combobox value. I want that when I select sheet name in drop down list that name should appear as combobox text or value. and also how can i stop some one to write in combobox as i want if some one write in combobox the msgbox should appear saying "Select from drop down list". Please can any friend solve my these queries about combobox. Thanks Private Sub ComboBox1_DropButtonClick() Dim Sh As Worksheet With ComboBox1 .CLEAR For Each Sh In ActiveWorkbook.Sheets If Sh.Name < "" Then .AddItem Sh.Name End If Next End With End Sub |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
To block direct entry into the combo box just change its Style to
fmStyleDropDownList. RE holding its value you might see how this works: Dim ItemIndex As Integer Private Sub ComboBox1_Change() If ComboBox1.ListIndex = 0 Then ItemIndex = ComboBox1.ListIndex End If End Sub Private Sub ComboBox1_DropButtonClick() Dim Sh As Worksheet With ComboBox1 .Clear For Each Sh In ActiveWorkbook.Sheets If Sh.Name < "" Then .AddItem Sh.Name End If Next .ListIndex = ItemIndex End With End Sub -- Jim "K" wrote in message ... | The code below list all the sheets name of active workbook in drop | down list. Because of the code line ".CLEAR" I am not able to get | combobox value. I want that when I select sheet name in drop down | list that name should appear as combobox text or value. and also how | can i stop some one to write in combobox as i want if some one write | in combobox the msgbox should appear saying "Select from drop down | list". Please can any friend solve my these queries about combobox. | Thanks | | Private Sub ComboBox1_DropButtonClick() | Dim Sh As Worksheet | With ComboBox1 | .CLEAR | For Each Sh In ActiveWorkbook.Sheets | If Sh.Name < "" Then | .AddItem Sh.Name | | End If | | Next | End With | | End Sub |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On Sep 18, 1:03*pm, "Jim Rech" wrote:
To block direct entry into the combo box just change its Style to fmStyleDropDownList. RE holding its value you might see how this works: Dim ItemIndex As Integer Private Sub ComboBox1_Change() * * If ComboBox1.ListIndex = 0 Then * * * * ItemIndex = ComboBox1.ListIndex * * End If End Sub Private Sub ComboBox1_DropButtonClick() * * Dim Sh As Worksheet * * With ComboBox1 * * * * .Clear * * * * * For Each Sh In ActiveWorkbook.Sheets * * * * * * * If Sh.Name < "" Then * * * * * * * * .AddItem Sh.Name * * * * * * * End If * * * * * Next * * * * * .ListIndex = ItemIndex * * End With End Sub -- Jim"K" wrote in message ... | The code below list all the sheets name of active workbook in drop | down list. *Because of the code line ".CLEAR" I am not able to get | combobox value. *I want that when I select sheet name in drop down | list that name should appear as combobox text or value. *and also how | can i stop some one to write in combobox as i want if some one write | in combobox the msgbox should appear saying "Select from drop down | list". *Please can any friend solve my these queries about combobox. | Thanks | | Private Sub ComboBox1_DropButtonClick() | Dim Sh As Worksheet | With ComboBox1 | * *.CLEAR | * * *For Each Sh In ActiveWorkbook.Sheets | * * * * *If Sh.Name < "" Then | * * * * * *.AddItem Sh.Name | | * * * * *End If | | * * *Next | End With | | End Sub Thanks lot Jim |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
fill combobox depending on selection from another combobox | Excel Discussion (Misc queries) | |||
Combobox items determined by the selection in another combobox | Excel Programming | |||
Combobox options based on the input of another combobox | Excel Programming | |||
ComboBox list reliant on the entry from a different ComboBox | Excel Programming | |||
How Do I Load A ComboBox RowSource From The Results Of Another ComboBox | Excel Programming |