Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
How do I change the state of an item in a (form) multiselect list box
I have a multiselect list box in a form that I need to use to
manipulate some other data. I have already defeated the problem of getting useful data out of the list box. The problem is that when the form with the list box is loaded, it populates the list box from scratch. How can I make the code select a specific entry? Listname.List(i).Select does not work. I can properly identify every list item that is being added and know its position in the list (as well as a reference cell that indicates if it should be selected). I just can't figure out how to select the appropriate items. Help would be greatly appreciated! Thanks! Brian |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
How do I change the state of an item in a (form) multiselect list box
Hi Brian,
Try usuing the ListBox's ListIndex property, the first item is item 0, the second is item 1. For example, to select the fourth item, try something like: '============= Private Sub UserForm_Initialize() With Me.ListBox1 .ColumnCount = 4 .List = Range("A1:D20").Value .ListIndex = 3 End With End Sub '<<============= --- Regards, Norman wrote in message ups.com... I have a multiselect list box in a form that I need to use to manipulate some other data. I have already defeated the problem of getting useful data out of the list box. The problem is that when the form with the list box is loaded, it populates the list box from scratch. How can I make the code select a specific entry? Listname.List(i).Select does not work. I can properly identify every list item that is being added and know its position in the list (as well as a reference cell that indicates if it should be selected). I just can't figure out how to select the appropriate items. Help would be greatly appreciated! Thanks! Brian |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
How do I change the state of an item in a (form) multiselect list
I'm not sure what you are after but:
ListBox1.Value = ListBox1.ListIndex(YourIndexNumber) This should return the value of whichever index number you put in the parentheses. " wrote: I have a multiselect list box in a form that I need to use to manipulate some other data. I have already defeated the problem of getting useful data out of the list box. The problem is that when the form with the list box is loaded, it populates the list box from scratch. How can I make the code select a specific entry? Listname.List(i).Select does not work. I can properly identify every list item that is being added and know its position in the list (as well as a reference cell that indicates if it should be selected). I just can't figure out how to select the appropriate items. Help would be greatly appreciated! Thanks! Brian |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Recording a macro to change item selected in drop down list | Excel Worksheet Functions | |||
How can I choose more than one item from list in a form in Excel? | Excel Worksheet Functions | |||
How to link macro to change an item in drop-down list | Excel Discussion (Misc queries) | |||
Multiselect Listbox - identify if item picked | Excel Programming | |||
List Box Multiselect Form | Excel Programming |