+ Reply to Thread
Results 1 to 5 of 5

Help with Add/Remove Items from One List Box to Another

  1. #1
    Forum Contributor
    Join Date
    03-30-2016
    Location
    Gillette, WY
    MS-Off Ver
    Office 365
    Posts
    230

    Help with Add/Remove Items from One List Box to Another

    Hello all,

    I am having trouble with some code to populate one User Form list box based on the values in another. The user has a list of available colors on the left and uses command buttons to either

    1) Add All
    2) Add Selected
    3) Remove Selected
    4) Remove All

    The Add All and Remove All functions are working but the Add/Removed selected is not.

    My code for Add Selected:
    Please Login or Register  to view this content.
    My code for Remove Selected, this function simply needs to remove the selected items from the list box, it does not need to repopulate them back to the other list box.

    Please Login or Register  to view this content.
    A copy of my project is attached. I have not yet written code for the other functions of the User Form.
    Attached Files Attached Files

  2. #2
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Help with Add/Remove Items from One List Box to Another

    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  3. #3
    Forum Contributor
    Join Date
    03-30-2016
    Location
    Gillette, WY
    MS-Off Ver
    Office 365
    Posts
    230

    Re: Help with Add/Remove Items from One List Box to Another

    Worked perfectly. Thank you. What was wrong with my initial code. Very new to VBA, your code looks similar but if you could point out the error, I would appreciate it. Thank you again!

  4. #4
    Forum Expert
    Join Date
    10-06-2017
    Location
    drevni ruchadlo
    MS-Off Ver
    old
    Posts
    2,143

    Re: Help with Add/Remove Items from One List Box to Another

    And you could shorten code a bit in other places, e.g.:
    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    03-30-2016
    Location
    Gillette, WY
    MS-Off Ver
    Office 365
    Posts
    230

    Re: Help with Add/Remove Items from One List Box to Another

    Thank you.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Remove items from dropdown list when item value = 0
    By technolog in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 11-21-2017, 09:57 AM
  2. Best way to remove items from list
    By TheRobsterUK in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-12-2014, 12:32 PM
  3. Replies: 1
    Last Post: 09-14-2013, 04:55 AM
  4. Replies: 2
    Last Post: 08-23-2011, 08:55 PM
  5. Remove matching items from a workbook based on a master list
    By Apel in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-16-2009, 08:20 PM
  6. cleaning up my list - remove items in the list
    By tmssj2000 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-06-2009, 02:00 AM
  7. remove items from list box (sorry it`s a bit long)
    By bahadirakcan in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-10-2006, 08:11 AM

Tags for this Thread

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