+ Reply to Thread
Results 1 to 7 of 7

Sorting within an array, or in a combobox

  1. #1
    Forum Contributor JP Romano's Avatar
    Join Date
    10-09-2008
    Location
    Princeton, NJ
    MS-Off Ver
    2010
    Posts
    500

    Sorting within an array, or in a combobox

    Hello all,
    Anybody out there know if there is a way to sort data in an array, or alternately, to sort in a combobox?

    Here's the situation...
    I have a userform with a combobox. That combobox is being populated by an array, which is storing filenames from a network directory. The code I'm using is below... basically, grabbing filenames from the directory and throwing them into the array. Then when the userform initializes, using that array to populate the combobox.


    Please Login or Register  to view this content.
    So, is there a way to alphabatize the filenames, without first writing them to the sheet?

    Thanks for any input!
    Last edited by JP Romano; 05-31-2011 at 09:25 AM. Reason: Solving thread

  2. #2
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Sorting within an array, or in a combobox

    Hi JP

    Look at this link...I've used the code successfully in the past http://www.cpearson.com/excel/SortingArrays.aspx
    John

    If you have issues with Code I've provided, I appreciate your feedback.

    In the event Code provided resolves your issue, please mark your Thread as SOLVED.

    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

  3. #3
    Forum Contributor
    Join Date
    02-19-2005
    Location
    Gurgaon,India
    MS-Off Ver
    2007,2010,2013
    Posts
    180

    Re: Sorting within an array, or in a combobox

    Hi,

    In a standard module

    Please Login or Register  to view this content.
    In userform module

    Please Login or Register  to view this content.
    HTH
    Kris

  4. #4
    Forum Contributor JP Romano's Avatar
    Join Date
    10-09-2008
    Location
    Princeton, NJ
    MS-Off Ver
    2010
    Posts
    500

    Re: Sorting within an array, or in a combobox

    Wonderful... thank you guys so much! Works like a charm!

  5. #5
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Sorting within an array, or in a combobox

    Why not using Excel ?

    Please Login or Register  to view this content.



  6. #6
    Forum Contributor JP Romano's Avatar
    Join Date
    10-09-2008
    Location
    Princeton, NJ
    MS-Off Ver
    2010
    Posts
    500

    Re: Sorting within an array, or in a combobox

    SNB, as I'm being asked to do more and more with Excel/VBA here at work, I try to find better, faster, smarter ways of doing things with each effort. With this little project, I wanted to force myself to use arrays, which are very new and interesting to me. My interest wasn't only in the end point, but different ways to get there. Hope that makes sense, and as always, thanks for taking the time to read and offer something incredible!

  7. #7
    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: Sorting within an array, or in a combobox

    One more alternative:
    Please Login or Register  to view this content.
    Entia non sunt multiplicanda sine necessitate

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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