+ Reply to Thread
Results 1 to 10 of 10

List box?

  1. #1
    Registered User
    Join Date
    06-06-2007
    Location
    NYC, NY
    Posts
    66

    List box?

    Hi,

    I have a list of items in a column. I would like to have a userform pop up with a list box (?) of all the items and I want to be able to select multiple items to perform an action on the row corresponding to the selected item.

    I am thinking of other examples I have seen where there are two list boxes (?) and then arrow buttons between them. When you click the arrow the item moves from one list box to the other to see which have been selected.

    I have never used list boxes before so if you have a link to some sample code that would be useful. Or if I should use another option please let me know.

    Thanks for any insights,
    ~RUTH~

  2. #2
    Forum Contributor
    Join Date
    08-28-2006
    Posts
    280

    Take a look here

    Dependant Dropdowns may be what your looking for.

    Take a look here.

    http://www.contextures.com/xlDataVal13.html

    and here.

    http://www.contextures.com/xlDataVal02.html

    Hope that's what you're looking for.

    Dean

  3. #3
    Registered User
    Join Date
    06-06-2007
    Location
    NYC, NY
    Posts
    66

    Unhappy Not excel but VB list boxes

    Hi Dean,

    Thanks for the neat post. I will try to use this sometime. Unfortunately it isn't what I am looking for. I am writing a macro and I have code to execute to the selected items. I really need a pop up window with list boxes.

    Currently I am playing with listboxes. I have two one with the list of all the items and another with the list of the selected items. My code isn't working though. How do I add items to the .List() array?

    ~RUTH~

  4. #4
    Forum Contributor
    Join Date
    08-28-2006
    Posts
    280

    Take a look at this

    Ruth,

    Sorry, but I'm a bit of a VBA non-entity. However, I downloaded this from VBA Express a long time ago and it may give you some ideas from looking at the code.

    Sorry, I can't be of more assistance.

    Dean
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    06-06-2007
    Location
    NYC, NY
    Posts
    66

    Unhappy More list box?

    Thanks for the file Dean. Unfortunately they don't use the list box.

    Does anyone know how to use multiselect listboxes? The below code works for a singleselect but not for multiselect. I know I am suppose to use .selected instead of .value but I am not sure how.

    Thanks,
    ~RUTH~


    Please Login or Register  to view this content.

  6. #6
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229
    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    06-06-2007
    Location
    NYC, NY
    Posts
    66

    Unhappy display value, not index #

    Hi Mike,

    Thanks for your post. How do you get the value stored in listbox(i)? Currently this just gives the index # i. I would like the corresponding item name.

    Thanks,
    ~RUTH~

  8. #8
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229
    Please Login or Register  to view this content.
    returns the i'th item in the list.

    Please Login or Register  to view this content.
    will show all selected items.
    Note that a userform's listbox's List is zero based. The first item in the list is
    Please Login or Register  to view this content.

  9. #9
    Registered User
    Join Date
    06-06-2007
    Location
    NYC, NY
    Posts
    66

    Red face Thanks! Still some bugs...

    Got it! Thank you so much for your help. Unfortunately I still have some bugs. I have two list boxes. And this is the code for when I want to add the selected items to the 2nd lb.

    Please Login or Register  to view this content.
    ~RUTH~

  10. #10
    Registered User
    Join Date
    06-06-2007
    Location
    NYC, NY
    Posts
    66

    Smile Fixed it!

    Ok I got it.

    ~RUTH~

    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1