+ Reply to Thread
Results 1 to 3 of 3

Sort listbox chronologically

  1. #1
    Registered User
    Join Date
    07-24-2011
    Location
    Ottawa
    MS-Off Ver
    Excel 2007
    Posts
    91

    Sort listbox chronologically

    Hi, I have a userform which populates a listbox (also in the form). Items in the listbox can be selected. This repopulates the form with the info of the item selected in case the user wants to edit an existing item.

    The listbox "lstMileStones" has 3 columns: txtMile.Value (name in text); txtCompDate.Value (date in text); chkCompleted.Value (y or blank)

    Items in the listbox get populated like that:

    Please Login or Register  to view this content.
    I would like to find a way to sort the items in the listbox BY DATE (i.e. second column) whenever an item is added to the listbox.

    Any way to do that directly in the VBA code?

    Many thanks.

  2. #2
    Registered User
    Join Date
    07-24-2011
    Location
    Ottawa
    MS-Off Ver
    Excel 2007
    Posts
    91

    Re: Sort listbox chronologically

    I have found this code which works for sorting a multicolumn listbox on the FIRST value. Any idea how I can modify to sort on the SECOND value which in may case is a date in format(dd-mmm-yyyy)?


    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    07-24-2011
    Location
    Ottawa
    MS-Off Ver
    Excel 2007
    Posts
    91

    Re: Sort listbox chronologically

    I got this to work on my second column. ONly problem seems to be that data there are dates in dd-mmm-yyyy format. Sorting seems not to be working correctly... Any idea?


    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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