Consulting

Results 1 to 4 of 4

Thread: Listbox selection and deselection triggers in userform

  1. #1
    VBAX Regular
    Joined
    Apr 2010
    Posts
    25
    Location

    Listbox selection and deselection triggers in userform

    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!

  2. #2
    VBAX Regular
    Joined
    Apr 2010
    Posts
    25
    Location
    if it helps, i've got the code for the second listbox here

    http://www.vbaexpress.com/forum/show...90&postcount=3

  3. #3
    Administrator
    VP-Knowledge Base
    VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    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
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

  4. #4
    VBAX Regular
    Joined
    Apr 2010
    Posts
    25
    Location
    Quote Originally Posted by mdmackillop
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •