+ Reply to Thread
Results 1 to 5 of 5

List Box multi select

  1. #1
    Registered User
    Join Date
    02-09-2009
    Location
    Washington, US
    MS-Off Ver
    Excel 2003
    Posts
    73

    List Box multi select

    This is a lot harder once you start doing it.. but...

    I have a database that is setup and I want to add a ListBox to the userform and I know how to do that and add all the listbox entries.. my trouble is how do i save the selected entries(multiselect) to sheet and load them to the form (what was selected) using what i have below?

    here is the code i am using to load

    HTML Code: 
    and to save

    HTML Code: 

    Hopefully this is clear enough... thanks for any help

    JJ
    Last edited by h_aesa1; 02-01-2010 at 08:10 AM.

  2. #2
    Registered User
    Join Date
    12-27-2009
    Location
    Paris, France
    MS-Off Ver
    Excel 2003
    Posts
    64

    Re: List Box multi select

    Hello,

    An example with

    1) create a UserForm1 with ListBox1 and copy the following code

    Please Login or Register  to view this content.
    2) Create a sheet "test" with more data in A1: C36

    3) copy the following code in a standard module

    Please Login or Register  to view this content.
    4) run the macro UFshow

    Best regards.

    PMO
    Patrick Morange
    Attached Files Attached Files

  3. #3
    Registered User
    Join Date
    02-09-2009
    Location
    Washington, US
    MS-Off Ver
    Excel 2003
    Posts
    73

    Re: List Box multi select

    I looked at your sheet..... I probably didn't word the question properly or explain well enough...

    Lets say I have a userform with ListBox1 (multiselect) and it loads with a bunch of cities... so the user chooses Denver and Detroit... then presses a command button and it saves that ListBox1 info to that record in my data.

    Now when I load that record using another command button i want the form to highlight his choices automatically (Denver and Detroit) but still show all the ListBox1 entries...

    I tried ListBox1.value = cells(n,5).value but there was an error

    I don't know if this is possible...thanks for any help

    JJ

  4. #4
    Registered User
    Join Date
    12-27-2009
    Location
    Paris, France
    MS-Off Ver
    Excel 2003
    Posts
    64

    Re: List Box multi select

    Hello,

    Here is a new version.
    I hardly understand English and I hope I have understood your request.
    Make a test with the new attachment.

    1) create a sheet named "test" and, from A1, put the city names.
    2) create a sheet named "save" and leave it blank.
    3) create a UserForm1 with CommandButton1 and CommandButton2.
    In the code window for the UserForm, copy the following code

    Please Login or Register  to view this content.
    4) In a standard module, copy the following code

    Please Login or Register  to view this content.
    5) Run the macro UFshow.

    Best regards.

    PMO
    Patrick Morange
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    02-09-2009
    Location
    Washington, US
    MS-Off Ver
    Excel 2003
    Posts
    73

    Re: List Box multi select

    thanks Patrick... I modified it to what I needed but it works great...

+ 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