+ Reply to Thread
Results 1 to 8 of 8

Sort ListBox alphabetically

  1. #1
    Registered User
    Join Date
    12-17-2014
    Location
    London, UK
    MS-Off Ver
    2016
    Posts
    54

    Sort ListBox alphabetically

    Hi All,

    I have the following code which grabs the list I need from a column, but I'd like it to sort it alphatebetically as it is a long list and would be eaiser to locate a name from it.

    Please help!

    Please Login or Register  to view this content.

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Sort ListBox alphabetically

    It would be easier to sort the data in sheet "MCS RAW DATA" before loading the list box. Is that a feasible option?
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Valued Forum Contributor
    Join Date
    11-28-2015
    Location
    indo
    MS-Off Ver
    2016 64 bitt
    Posts
    1,265

    Re: Sort ListBox alphabetically

    Maybe like this
    Please Login or Register  to view this content.
    Last edited by daboho; 11-08-2018 at 01:38 PM.

  4. #4
    Registered User
    Join Date
    12-17-2014
    Location
    London, UK
    MS-Off Ver
    2016
    Posts
    54
    Quote Originally Posted by 6StringJazzer View Post
    It would be easier to sort the data in sheet "MCS RAW DATA" before loading the list box. Is that a feasible option?
    There's a lot of data so ideally want to avoid touching it!
    But if it does a clean sort, then don't mind.

    The sheet has about 15 columns, and hundreds of rows!

    Also, if you can help with only adding name once (remove duplicates), that would be great!

    Thanks

  5. #5
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Sort ListBox alphabetically

    Looks like daboho has a good solution. Anything that has a sort built in is better than writing one from scratch. I don't know about the duplicates part, though. The Dictionary class seems to handle that well.

  6. #6
    Valued Forum Contributor
    Join Date
    11-28-2015
    Location
    indo
    MS-Off Ver
    2016 64 bitt
    Posts
    1,265

    Re: Sort ListBox alphabetically

    If you want sort and take.unique
    Perhab like this not sure
    Please Login or Register  to view this content.
    Or maybe like this
    Please Login or Register  to view this content.
    Last edited by daboho; 11-08-2018 at 02:22 PM.

  7. #7
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,523

    Re: Sort ListBox alphabetically

    Quote Originally Posted by alimsab View Post
    The sheet has about 15 columns, and hundreds of rows!

    Also, if you can help with only adding name once (remove duplicates), that would be great!
    Try this
    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    12-17-2014
    Location
    London, UK
    MS-Off Ver
    2016
    Posts
    54

    Re: Sort ListBox alphabetically

    Tried second one, and looks like it's done it! Thanks

+ 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] Need to alphabetically sort listbox.
    By IMM Tech in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 04-24-2018, 12:59 PM
  2. [SOLVED] Sort selected userform listbox items alphabetically
    By kosherboy in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 04-20-2016, 12:15 AM
  3. Sort Alphabetically
    By Bob@Sun in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 08-23-2015, 10:18 AM
  4. How to sort a listbox alphabetically?...
    By 10121730 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-01-2012, 03:03 AM
  5. sort alphabetically and numerically, then sort rows
    By luke20allen in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 10-01-2008, 07:00 AM
  6. Listbox to be Alphabetically sorted
    By coreytroy in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-19-2007, 07:07 AM
  7. sort by alphabetically
    By HOW CAN I SORT BY ALPHABETICALLY FROM A in forum Excel - New Users/Basics
    Replies: 4
    Last Post: 05-12-2005, 01:06 AM

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