ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   ComboBox with an editable function (https://www.excelbanter.com/excel-programming/290937-combobox-editable-function.html)

bostonlady

ComboBox with an editable function
 
Does anyone know how to create a list box to allow the user to choos
AND allow the user to enter new data if he/she selects one item fro
the list? For example "other" would allow the user to add an item

--
Message posted from http://www.ExcelForum.com


Harald Staff

ComboBox with an editable function
 
When "other" is clicked, some entry field component of some sort becomes visible, maybe
even modal, and when entry there is complete, this entry gets transferred to the listbox
and selected. It takes several components and some VBA of coding to do since you can't
type into a listbox.

--
HTH. Best wishes Harald
Followup to newsgroup only please.

"bostonlady " wrote in message
...
Does anyone know how to create a list box to allow the user to choose
AND allow the user to enter new data if he/she selects one item from
the list? For example "other" would allow the user to add an item.


---
Message posted from http://www.ExcelForum.com/




bostonlady[_2_]

ComboBox with an editable function
 
Would you happen to know where I might find a code example to do this?

Thank yo

--
Message posted from http://www.ExcelForum.com


Harald Staff

ComboBox with an editable function
 
This is a quite primitive solution, using Windows' inputbox:

Private Sub ListBox1_Click()
Dim S As String
If ListBox1.Text = "Other" Then
S = InputBox("Enter new item:")
If S < "" Then _
ListBox1.AddItem S, _
ListBox1.ListIndex
End If
End Sub
--
HTH. Best wishes Harald
Followup to newsgroup only please

"bostonlady " skrev i melding
...
Would you happen to know where I might find a code example to do this?

Thank you


---
Message posted from http://www.ExcelForum.com/





All times are GMT +1. The time now is 10:05 AM.

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