PDA

View Full Version : Listbox selection and deselection triggers in userform



Shortz
05-01-2010, 06:48 PM
Heya,

Question on listboxes (again). I have two listboxes in a userform and the second one populates itself based on the first one. the macro to populate the second listbox stores selections from LB1 in an array and searches lists and deletes non selected rows and the remaining cells become the rowsource for the second listbox.

When this runs it causes the selections in LB1 to be unselected. Is there likely to be a simple reason for this? does the array triggers deselection? or do i need to store the selections from LB1 and at the end of the macro recall those selections?

thanks in advance for any help!

Shortz
05-01-2010, 06:52 PM
if it helps, i've got the code for the second listbox here

http://www.vbaexpress.com/forum/showpost.php?p=212090&postcount=3

mdmackillop
05-02-2010, 07:58 AM
A sample workbook would help. On the face of it I would create an array from the found values and add this using the List function to the second list box

Shortz
05-02-2010, 10:03 PM
A sample workbook would help. On the face of it I would create an array from the found values and add this using the List function to the second list box

The code in the link does that. and there should be some pictures to see what was happening.

I guess the question is more academic: what would cause the selection in the first listbox to become unselected if i'm taking those selected values in putting them into an array to then use to generate the second listbox.