+ Reply to Thread
Results 1 to 5 of 5

Alphabetize Combobox Items

  1. #1
    Registered User
    Join Date
    09-11-2009
    Location
    MN
    MS-Off Ver
    Office 2010
    Posts
    48

    Alphabetize Combobox Items

    I have a significant number of comboboxes on a multipage userform. Almost all of them are populated dynamically (it takes the user choice from one combobox, looks for that value on the spreadsheet and if it finds it, it takes whats in the next column and adds it to another combobox). This works great.

    My problem is that all the items in these other comboboxes are not in alphabetical order. I'd like to find some code that will work for all my comboboxes so that I don't have to have the same code over and over again for each field.

    I found the code below and that works to alphabetize the dropdown, but I still have to use it over and over again and change it for each fieldname (in red). I tried to use a variant and just make the value the same as each fieldname before it calls the sub and whats in red below was just my variable but that just crashes my excel.


    Please Login or Register  to view this content.
    If you have something better to alphabetize all the comboboxes or can somehow work with what I've found, any help would be greatly appreciated!
    Last edited by XLVBA; 01-19-2010 at 05:09 PM.

  2. #2
    Forum Expert Palmetto's Avatar
    Join Date
    04-04-2007
    Location
    South Eastern, USA
    MS-Off Ver
    XP, 2007, 2010
    Posts
    3,978

    Re: Alphabetize Combobox Items

    Why not just sort the row source for each combo box?
    Palmetto

    Do you know . . . ?

    You can leave feedback and add to the reputation of all who contributed a helpful response to your solution by clicking the star icon located at the left in one of their post in this thread.

  3. #3
    Registered User
    Join Date
    09-11-2009
    Location
    MN
    MS-Off Ver
    Office 2010
    Posts
    48

    Re: Alphabetize Combobox Items

    Theres a lot of other stuff going on with the spreadsheet (that work super slick), that I really...really would like to avoid having to sort it for each box.

  4. #4
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Alphabetize Combobox Items

    Maybe like this:
    Please Login or Register  to view this content.
    It surely needs some error checking.
    Entia non sunt multiplicanda sine necessitate

  5. #5
    Registered User
    Join Date
    09-11-2009
    Location
    MN
    MS-Off Ver
    Office 2010
    Posts
    48

    Re: Alphabetize Combobox Items

    I was able to make it work with what I have and for any cbo field without having to repost it. I just reassign my variables before calling the procedure.

    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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