+ Reply to Thread
Results 1 to 8 of 8

multi select listbox, remove selected items.

  1. #1
    Valued Forum Contributor
    Join Date
    05-14-2009
    Location
    gold coast
    MS-Off Ver
    Excel 2007
    Posts
    843

    multi select listbox, remove selected items.

    i have a multi select listbox that i want to be able to remove the selected items in one hit.
    i have not been able to convert code for removing single selected items and could not find a working example.

    cheers

    this is probley the closest though cos its removing items it plays havoc with the listcount
    Please Login or Register  to view this content.

    ummm this may not bee a issue now.
    Excel had a fatal error and closed and now when it open the file i get errors accoured during load ok that and then it says that it removed the vba project part, is the a fix for this as i didnot have a backup copy of this file.
    I got one from the temp folder though it is a old file.
    Well i think i just learnt a valuable lesson.
    gotta love the things we hate at times
    System Volume Information, workbook is not diffrent from the last work.

    so i guess the question above about the listbox still stands, maby a couple hrs before ill be there though.
    Last edited by D_Rennie; 10-25-2009 at 05:46 AM.

  2. #2
    Valued Forum Contributor JeanRage's Avatar
    Join Date
    03-02-2009
    Location
    Nice, France
    MS-Off Ver
    Excel 2003
    Posts
    705

    Re: multi select listbox, remove selected items.

    Hi,

    Debra has designed an elegant solution ...which can help you out ...

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

    HTH

  3. #3
    Valued Forum Contributor
    Join Date
    05-14-2009
    Location
    gold coast
    MS-Off Ver
    Excel 2007
    Posts
    843

    Re: multi select listbox, remove selected items.

    Thankyou JeanRage.

    Not realy what i was after, I didnot explain my request better.

    Cheers again though.
    Last edited by D_Rennie; 10-25-2009 at 05:46 AM.

  4. #4
    Valued Forum Contributor
    Join Date
    05-14-2009
    Location
    gold coast
    MS-Off Ver
    Excel 2007
    Posts
    843

    Re: multi select listbox, remove selected items.

    solution was to loop backwads
    Please Login or Register  to view this content.
    Last edited by D_Rennie; 10-25-2009 at 05:52 AM.

  5. #5
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: multi select listbox, remove selected items.

    The removal will be affected by how the Listbox is populated
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  6. #6
    Valued Forum Contributor
    Join Date
    05-14-2009
    Location
    gold coast
    MS-Off Ver
    Excel 2007
    Posts
    843

    Re: multi select listbox, remove selected items.

    The removal will be affected by how the Listbox is populated
    ok??

    I have populated the listbox using the Application.GetOpenFilename MultiSelect:=True.
    and the second has been populated from another listbox.
    The code hasnot seamed to fail yet though i have only tested it a couple times.
    both using .additem
    Last edited by D_Rennie; 10-25-2009 at 07:49 AM.

  7. #7
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: multi select listbox, remove selected items.

    If I remeber correctly RemoveItem only works with Listboxes populated using AddItem, which you have in this case.

  8. #8
    Valued Forum Contributor
    Join Date
    05-14-2009
    Location
    gold coast
    MS-Off Ver
    Excel 2007
    Posts
    843

    Re: multi select listbox, remove selected items.

    Yes you are correct, This code will not work if the listbox is populated from a rowsource.

    Will still work if populated from array
    Please Login or Register  to view this content.
    so im guessing that rowsource is the only one that dips out on this one.

    cheers.
    Last edited by D_Rennie; 10-25-2009 at 08:52 AM.

+ 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