ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Can you Sort Listbox Values Alphabetically by code? (https://www.excelbanter.com/excel-programming/383482-can-you-sort-listbox-values-alphabetically-code.html)

Corey

Can you Sort Listbox Values Alphabetically by code?
 



Martin Fishlock

Can you Sort Listbox Values Alphabetically by code?
 
Corey:

You can't automatically get them sorted in a list box but you can add items
at specific places.

So the easiest way to do it is to sort the items in an array prior to
putting them on the listbox.

And you can add the array at once.

Note for bound items this cannot be done. (sort the bound list.)
--
Hope this helps
Martin Fishlock, Bangkok, Thailand
Please do not forget to rate this reply.


"Corey" wrote:





Dave Peterson

Can you Sort Listbox Values Alphabetically by code?
 
John Walkenbach shows how:
http://j-walk.com/ss/excel/tips/tip47.htm

Corey wrote:

--

Dave Peterson

Tom Ogilvy

Can you Sort Listbox Values Alphabetically by code?
 
Martin has given good advice in emphasizing that items don't have to be
isnerted at the end of the list. Here is some addtional information:

This article by John Walkenbach shows how to fill a listbox (or combobox)
with a unique list of sorted items. You can use the whole approach or
extract what you need and adapt it to your situation.

http://www.j-walk.com/ss/excel/tips/tip47.htm

--
Regards,
Tom Ogilvy


"Corey" wrote:






All times are GMT +1. The time now is 07:50 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com