View Single Post
  #9   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Sorting of values within a list box

Compare as numbers rather than strings.

If clng(.List(i)) clng(.List(j)) Then

--
Regards,
Tom Ogilvy


"Zippy " wrote in message
...
Bob,

Thanks, much appreciated. I had to change "" to "<" and "i = 0 to"
instead of "i = 1 to" and it works.

However, the numbers being sorted range from 1 to 16 and when sorted
the order is 1,10,11,12,13,14,15,16,2,3,4,5 etc etc. Is there an easy
way to change this to 1,2,3,4 etc. If not I can populate it with
01,02,03 and then trim off the "0" later which I think will get around
the problem.

Thanks for your help


---
Message posted from http://www.ExcelForum.com/