FlexGrid Sorting Question....

Posted on 2005-04-11
Last Modified: 2008-02-26
If my column is text and represents time-of-day:
ie:     7:00am    11:30am    4:50pm    etc.
This sort command:
MSFlex2.Sort = flexSortStringAscending
puts 4:50pm in front of 7:00am because of the numerics.
What command will sort my grid according to time-of-day?
Question by:rbend
    1 Comment
    LVL 6

    Accepted Solution

    create another column with 0 width (.ColWidth(c) = 0; where c is the column); then based on your column with the time, copy the value to the 0 width column and format with FORMAT(CDate(.textmatrix(.row, 1)), "HH:mm:ss"). therefore, assuming that the time column is 1 and your 0 width column (or your sort column) is 2 then:

    MSFlex2.textmatrix(.row, 2) = Format(MSFlex2.textmatrix(.row,1),"HH:mm:ss")
    MSFlex2.colsel = 2      'this will set the column with the military time format as your sorting column
    MSFlex2.Sort = flexSortStringAscending



    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to improve team productivity

    Quip adds documents, spreadsheets, and tasklists to your Slack experience
    - Elevate ideas to Quip docs
    - Share Quip docs in Slack
    - Get notified of changes to your docs
    - Available on iOS/Android/Desktop/Web
    - Online/Offline

    Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
    The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
    Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
    This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

    794 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now