+ Reply to Thread
Results 1 to 4 of 4

Alphabetically sorting a ListBox

  1. #1
    Valued Forum Contributor
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Office 365 64-Bit, 2108, build 14326.21018
    Posts
    4,056

    Alphabetically sorting a ListBox

    I made a little column navigator, and used the below macro to sort the column list alphabetically. It works well except for when it doesn't. I've attached my workbook so you can see it in operation. The issue I first noticed is FUNCTION comes before Full, CPS UNIT comes before City, Cost Pool Up comes before Cost of Living; I'm thinking it may be a CASE thing, but if so I don't know how to correct it. Any help would be appreciated.

    Please Login or Register  to view this content.
    Attached Files Attached Files
    I know I'm not stupid, but I suspect I'm a lot stupider than I think I am

  2. #2
    Valued Forum Contributor
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Office 365 64-Bit, 2108, build 14326.21018
    Posts
    4,056

    Re: Alphabetically sorting a ListBox

    I figured it out. Just had to put this at the top of the module.

    Please Login or Register  to view this content.

  3. #3
    Forum Expert Greg M's Avatar
    Join Date
    08-16-2007
    Location
    Dublin. Ireland
    MS-Off Ver
    Office 2016
    Posts
    4,641

    Re: Alphabetically sorting a ListBox

    Hi there,

    Yes, I think it was "a CASE thing" all right!

    See if the following version of your code does what you need:

    Please Login or Register  to view this content.
    Nice application by the way!


    Hope this helps.

    Regards,

    Greg M



    P. S.

    By the way, The chapter on "Optimizing VBA Performance" in "Professional Excel Development" (Bovey, Wallentin, Bullen & Green) says that the use of Option Compare Text isn't really recommended.

    Just pointing it out for what it's worth
    Last edited by Greg M; 04-29-2019 at 12:38 PM. Reason: P. S. added

  4. #4
    Forum Expert Greg M's Avatar
    Join Date
    08-16-2007
    Location
    Dublin. Ireland
    MS-Off Ver
    Office 2016
    Posts
    4,641

    Re: Alphabetically sorting a ListBox

    Hi again,

    Many thanks for the Reputation increase - much appreciated!

    Best regards,

    Greg M

+ 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] Sort ListBox alphabetically
    By alimsab in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 11-09-2018, 11:39 AM
  2. [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
  3. [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
  4. Sorting MCQ questions alphabetically
    By kokoman789 in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 11-08-2013, 06:26 PM
  5. How to sort a listbox alphabetically?...
    By 10121730 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-01-2012, 03:03 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. Sorting Alphabetically
    By Jack in forum Excel General
    Replies: 1
    Last Post: 01-15-2005, 05:06 PM

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