Consulting

Results 1 to 4 of 4

Thread: Ordering a listbox

  1. #1

    Ordering a listbox

    Hi, i was wondering if there is any instruction to order (by number or alpha) a combobox or a listbox. currently i have a function that compares each one of the entries and orders it but when I go over 500 entries it takes quite a while.

    pd: is .zorder what im looking for? cause if it is its not working

  2. #2
    VBAX Contributor
    Joined
    Jul 2005
    Posts
    169
    Location
    Hi

    How are you populating the List/Combo Box?

    Single / Multi collumn?

  3. #3
    Site Admin
    Jedi Master
    VBAX Guru Jacob Hilderbrand's Avatar
    Joined
    Jun 2004
    Location
    Roseville, CA
    Posts
    3,712
    Location
    ZOrder refers to the placement of the control and doesn't have anything to do with the data in the control.

    Like jindon stated, it will depend on how you are filling the control. If you are using a Row Source, then just make sure the data is already sorted. If you are using AddItem, then just make sure the data is sorted first.

    For Add Item, what I would do (assuming the starting data is not sorted and you do not want to change it to be sorted) is load all the data to an usused column, then sort the column, load the data to the control, then clear the data in the column.

  4. #4
    VBAX Mentor
    Joined
    Sep 2004
    Location
    Nashua, NH, USA
    Posts
    489
    Location
    Quote Originally Posted by Maka
    Hi, i was wondering if there is any instruction to order (by number or alpha) a combobox or a listbox. currently i have a function that compares each one of the entries and orders it but when I go over 500 entries it takes quite a while.

    pd: is .zorder what im looking for? cause if it is its not working
    It is far more efficient to NOT use Excel's built-in sorting.

    See http://www.standards.com/index.html?Sorting.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •