Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Code for combobox

I am struggling to write code that allows the user to progressively
select a value from a list. For example from a long list the user
could type R to show all the items starting with R, then type o, to
reduce the list to all items starting with Ro etc.

Secondly if the user types a term that is not on the list, it should
be added to the list for future selection.

As I see it this is the primary purpose of a combo-box but I cant find
the above code. Any help will be appreciated.
Thanks,
Rod
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 149
Default Code for combobox

REM,

How do you plan on loading your ComboBox?

My initial thoughts are that you can create the combo box list in a
worksheet (which you could make hidden or very hidden) to store the values
for the combo box. It's likely that you can then use the ListIndex property
to test whether the item is in the combo box or not. (A value of -1 means
that the item is not in the list). If the item isn't in the list, you can
append it to your combo box list on the aforementioned worksheet.

If you choose to add the items in the combo box via a worksheet, then you
can utilize the RowSource property to load the items quite quickly;
otherwise, you'll need to use the AddItem method. I hope this is enough to
get you started.

Best,

Matthew Herbert

"REM" wrote:

I am struggling to write code that allows the user to progressively
select a value from a list. For example from a long list the user
could type R to show all the items starting with R, then type o, to
reduce the list to all items starting with Ro etc.

Secondly if the user types a term that is not on the list, it should
be added to the list for future selection.

As I see it this is the primary purpose of a combo-box but I cant find
the above code. Any help will be appreciated.
Thanks,
Rod

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,298
Default Code for combobox

you could do this with a userform. I like to use 2 list boxes and an edit box
one list box should hold all the data and should have visible = false
The text box is the filter. each time a character is typed to the exit box,
the listbox is filtered and results placed into the 2nd listbox. Works well
and can easily be adapted for adding values if they don't exist.

If this is atill an issue, I can let you have a demo spreadsheet.



"REM" wrote:

I am struggling to write code that allows the user to progressively
select a value from a list. For example from a long list the user
could type R to show all the items starting with R, then type o, to
reduce the list to all items starting with Ro etc.

Secondly if the user types a term that is not on the list, it should
be added to the list for future selection.

As I see it this is the primary purpose of a combo-box but I cant find
the above code. Any help will be appreciated.
Thanks,
Rod

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
combobox code [email protected] uk Excel Discussion (Misc queries) 0 December 20th 09 06:21 PM
combobox code [email protected] uk Excel Discussion (Misc queries) 0 December 20th 09 08:28 AM
combobox code [email protected] uk Excel Discussion (Misc queries) 2 December 19th 09 08:37 AM
Code for ComboBox Tom Ogilvy Excel Programming 4 September 10th 06 07:28 PM
Code for ComboBox JLGWhiz Excel Programming 0 September 8th 06 03:40 AM


All times are GMT +1. The time now is 02:58 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"