View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Ron Rosenfeld[_2_] Ron Rosenfeld[_2_] is offline
external usenet poster
 
Posts: 1,045
Default Sort a range of strings using VBA code?

On Mon, 27 Aug 2012 12:10:32 -0700, "Robert Crandal" wrote:

I've tried the built-in sort already. I prefer to sort a range of
strings myself now.

If I load my strings into an array of strings how would you
sort that?


If you prefer to sort the strings yourself, you should educate yourself on the various sorting algorithms, of which there are many. Which one will work best for you depends on your data.

Don't forget, though, that Excel's built-in sort can be implemented in VBA, and will probably be easier to implement, as well as being fairly quick.

See http://en.wikipedia.org/wiki/Sorting_algorithm for a discussion of some of the various popular sorting algorithms, and their pros and cons. After you decide on a sorting algorithm, you will probably be able to find examples of VBA implementations on the web.