+ Reply to Thread
Results 1 to 7 of 7

Double Listbox movement - Maintain Order

  1. #1
    Registered User
    Join Date
    07-20-2015
    Location
    Lisbon, Portugal
    MS-Off Ver
    Office 2013
    Posts
    13

    Double Listbox movement - Maintain Order

    Hello everyone! This is my first time posting on ExcelForum, I am usually a lurker just checking stuff out - and usually it helps, but this time I'm truly stuck.

    Basically what I am doing is... I have 2 listboxes in a userform. With 4 buttons.

    Button One to move the selection (single or multiple items) from Listbox1 to Listbox2 and removing those items from Listbox1
    Button Two to move all list items from Listbox1 to Listbox2 and clearing Listbox1.
    Button Three to move the selection (single or multiple items) from Listbox2 to Listbox1 and removing those items from Listbox2.
    Button Four to move all list items from Listbox2 to Listbox1 and clearing Listbox2.

    The following is my code:

    Please Login or Register  to view this content.
    What I'm having problems with, is the following:

    I want the order to remain as it is shown above. When moving back and forward between listboxes by pressing the button. Anyone know a solution to this without using a hidden sheet (i.e. only with coding)

    Please Login or Register  to view this content.
    I have spent so long on this... I just can't seem to solve it. I have fixed it for transfering all, as that is pretty simple. Clear Listbox and additem again etc...

    Thanks guys, looking for help!

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

    Re: Double Listbox movement - Maintain Order

    Hi and welcome to the forum.

    Try this...

    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
    Registered User
    Join Date
    07-20-2015
    Location
    Lisbon, Portugal
    MS-Off Ver
    Office 2013
    Posts
    13

    Re: Double Listbox movement - Maintain Order

    You are amazing . I had actually done a much more complicated thing haha. I got mine to work too, but yours makes much more sense. I basically did it step by step for what I wanted to happen.

    i.e.
    1. Select - Move selected
    2. Clear list 1
    3. Put all in List 1
    4. Select what's in List 2 in List 1
    5. Clear List 2
    6. Move stuff from list 1 to List 2
    7. Delete these "stuff" from list 1

    Haha. Well it works, thanks so much buddy . Just for your information, and not to lose information; my code:

    Please Login or Register  to view this content.
    Last edited by Koncker; 07-29-2015 at 06:33 PM.

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

    Re: Double Listbox movement - Maintain Order

    You're welcome. Thanks for the feedback.

  5. #5
    Registered User
    Join Date
    07-20-2015
    Location
    Lisbon, Portugal
    MS-Off Ver
    Office 2013
    Posts
    13

    Re: Double Listbox movement - Maintain Order

    Hey AlphaFrog, I have one more question. Since you showed me how to add to list the range...

    Please Login or Register  to view this content.
    How would I do it if it my range was C2, D2, E2, ... , O2 and then Q2 - T2, V2, W2, Y2 - AA2 ?

    As in.. I have columns seperated in the middle. So I cant add the full range.

    Please Login or Register  to view this content.
    PS: I know this doesn't work as this just changes the list to what the new range values are... but I'm wondering how to add them all.

    This is what I currently have:

    Please Login or Register  to view this content.
    Or is there a simpler way, Could I seperate the ranges via comma?
    Last edited by Koncker; 07-30-2015 at 05:10 AM.

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

    Re: Double Listbox movement - Maintain Order

    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    07-20-2015
    Location
    Lisbon, Portugal
    MS-Off Ver
    Office 2013
    Posts
    13

    Re: Double Listbox movement - Maintain Order

    Thanks again AlphaFrog .

+ 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. [SOLVED] Double Click Listbox question
    By frostii in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-17-2015, 09:15 PM
  2. [SOLVED] Maintain selected listbox items when reopening worksheet (issue)
    By Platinum3x in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-09-2014, 11:47 PM
  3. Double click Listbox to edit item
    By johan12 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-22-2012, 04:12 AM
  4. Replies: 8
    Last Post: 08-15-2012, 02:42 AM
  5. Maintain double-click feature
    By rlarkin in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-18-2011, 07:09 AM
  6. userForm listBox being double-loaded
    By bstubbs in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 07-16-2009, 06:34 PM
  7. [SOLVED] Need selected item from listbox after double click
    By [email protected] in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-23-2006, 11:20 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