ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Input box to update combo box (https://www.excelbanter.com/excel-programming/321280-input-box-update-combo-box.html)

HFB

Input box to update combo box
 
I have a combo box with several choices in it including "other". I would
like to make it so that when the "other" option is selected, an input box
appears. When the user types in the details and presses enter, I want the
stuff they've typed to show as the selection in the combo box.

If that can't be done, then I'd like the input box to update a text box
below the combo box with the inputted data.

How to?


Chip[_3_]

Input box to update combo box
 
do you know how to make a userform?


HFB

Input box to update combo box
 
yes

"Chip" wrote:

do you know how to make a userform?



Tom Ogilvy

Input box to update combo box
 
Private Sub Combobox1_Click()
if Combobox1.Value = "Other" then
res = Inputbox("enter special selection")
if res < "" then
combobox1.Value = res
End if
End if
End Sub

Make sure the style of the combobox is fmStyleDropDownCombo
This is the default, so if you haven't changed it you should be OK.

--
Regards,
Tom Ogilvy


"HFB" wrote in message
...
yes

"Chip" wrote:

do you know how to make a userform?





HFB

Input box to update combo box
 
BEAUTIFUL! Thanks heaps Tom :)

"Tom Ogilvy" wrote:

Private Sub Combobox1_Click()
if Combobox1.Value = "Other" then
res = Inputbox("enter special selection")
if res < "" then
combobox1.Value = res
End if
End if
End Sub

Make sure the style of the combobox is fmStyleDropDownCombo
This is the default, so if you haven't changed it you should be OK.

--
Regards,
Tom Ogilvy


"HFB" wrote in message
...
yes

"Chip" wrote:

do you know how to make a userform?






Edu[_2_]

Input box to update combo box
 
Does this solution add the new text to the drop down menu? so that next time
you use the combobox that value will be present?

"HFB" wrote:

BEAUTIFUL! Thanks heaps Tom :)

"Tom Ogilvy" wrote:

Private Sub Combobox1_Click()
if Combobox1.Value = "Other" then
res = Inputbox("enter special selection")
if res < "" then
combobox1.Value = res
End if
End if
End Sub

Make sure the style of the combobox is fmStyleDropDownCombo
This is the default, so if you haven't changed it you should be OK.

--
Regards,
Tom Ogilvy


"HFB" wrote in message
...
yes

"Chip" wrote:

do you know how to make a userform?







All times are GMT +1. The time now is 04:24 AM.

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