+ Reply to Thread
Results 1 to 8 of 8

Moving items between ListBoxes

  1. #1
    Registered User
    Join Date
    07-16-2016
    Location
    Belo Horizonte, Brazil
    MS-Off Ver
    2016
    Posts
    22

    Moving items between ListBoxes

    Good afternoon,

    I am working on a form containing three listboxes. I have created buttons to be able to freely transfer data from one listbox to another, but I'm stuck at the code. The data that populates the listboxes upon form activation comes from different worksheets in the same workbook. So,when I transfer an item from one listbox to another, the code is supposed to delete the entire row from one sheet and paste it to the destination sheet. After that the form reloads and the listbox is populated with the realoted results.

    I have seen some guides on how to create "move to the right" or "move to the left" buttons, but they don't seem to realy apply since they don't effectively transfer the original data between the sheets.

    So far I came up with this code, it does function on the first time, but then the row count starts playing off. Besides the form doesn't refresh, so I need to close it and open again to show the updated lists. Code folows below:

    Please Login or Register  to view this content.
    Any ideas?

    (Crossposted from http://www.mrexcel.com/forum/excel-q...ml#post4589188)

  2. #2
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,447

    Re: Moving items between ListBoxes

    Hi Boechat,

    This sounds like you need to learn about Dynamic Named Ranges. You would then use the Name in your code which would span all the rows on the sheet.

    http://www.ozgrid.com/Excel/DynamicRanges.htm
    http://www.bettersolutions.com/excel...G820716330.htm
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  3. #3
    Registered User
    Join Date
    07-16-2016
    Location
    Belo Horizonte, Brazil
    MS-Off Ver
    2016
    Posts
    22

    Re: Moving items between ListBoxes

    Thanks, MArvinP.

    Gonna give it a look right now!

  4. #4
    Registered User
    Join Date
    07-16-2016
    Location
    Belo Horizonte, Brazil
    MS-Off Ver
    2016
    Posts
    22

    Re: Moving items between ListBoxes

    OK, I've tried naming my range now and to use it dynamically, however, I cannot get the range named. Excel seems to find an error on my formula and highlights the text in red for me:

    =OFFSET($A$1,0,0,COUNTA($A:$A),COUNTA($1:$1))

    What am I doing wrong?

  5. #5
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2507 (Windows 11 Home 24H2 64-bit)
    Posts
    91,883

    Re: Moving items between ListBoxes

    Your post does not comply with Rule 8 of our Forum RULES. Do not crosspost your question on multiple forums without including links here to the other threads on other forums.

    Cross-posting is when you post the same question in other forums on the web. The last thing you want to do is waste people's time working on an issue you have already resolved elsewhere. We prefer that you not cross-post at all, but if you do (and it's unlikely to go unnoticed), you MUST provide a link (copy the url from the address bar in your browser) to the cross-post.

    Expect cross-posted questions without a link to be closed and a message will be posted by the moderator explaining why. We are here to help so help us to help you!

    Read this to understand why we ask you to do this, and then please edit your first post to include links to any and all cross-posts in any other forums (not just this site).
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help. It's a universal courtesy.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    NB:
    as a Moderator, I never accept friendship requests.
    Forum Rules (updated August 2023): please read them here.

  6. #6
    Registered User
    Join Date
    07-16-2016
    Location
    Belo Horizonte, Brazil
    MS-Off Ver
    2016
    Posts
    22

    Re: Moving items between ListBoxes

    Hello, AliG. I'm sorry, but I did reference the corssposting at the end of my post, not only here, but in the other forum as well.

    Take a look a t last row in my post.

  7. #7
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,447

    Re: Moving items between ListBoxes

    I can use your formula above in my workbook. Are you sure you are putting it into a NEW Name in your Names Manager found on the Formulas Tab?

    https://support.office.com/en-us/art...2-ABD7FF379C64

  8. #8
    Registered User
    Join Date
    07-16-2016
    Location
    Belo Horizonte, Brazil
    MS-Off Ver
    2016
    Posts
    22

    Re: Moving items between ListBoxes

    Thanks for your support, MarvinP. Thread has been resolved in the crosspost link!

+ 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. Moving multiple column rows between 2 listboxes
    By DazlerD in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 09-05-2013, 11:23 AM
  2. Same order of listbox items in two listboxes
    By aman1234 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-25-2010, 09:55 AM
  3. Drag and Drop Multiple Items across listboxes
    By karan in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-29-2009, 07:46 AM
  4. sort items of listboxes with multiple columns
    By borg in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-02-2006, 04:50 PM
  5. Listboxes and select items in it
    By droopy928gt in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 03-03-2006, 08:32 AM
  6. Replies: 3
    Last Post: 02-17-2006, 12:15 AM
  7. Chart items moving around
    By Marcus Langell in forum Excel General
    Replies: 3
    Last Post: 08-12-2005, 03:05 PM
  8. Chart items moving around
    By Marcus Langell in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 07-26-2005, 05:05 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