Ischyros
12-30-2008, 04:10 PM
I havecontrol on a worksheet that presents the user with a userform allowing them to select how they would like to sort the information on the worksheet. For example I have several columns of information associated with projects like completion date, cost, engineer, contractor, etc.
When the click the button a user form appears where the select the information field to sort the list by....I am having a problem when it comes to sorting the projects by the date.
The problem is that when is sorts by the date it doesn't completely work. Specifically, it does not know what to do with blanks as they are randomly distributed down the rows and the dates end up not being sorted in ascending order at all.
When I do this manually it works just fine.......Any suggestions, code is below
:banghead: .
sub sort()
Worksheets("Project List").Range("A3:CL65536").Select
Selection.Sort Key1:=Range("X3"), Order1:=xlAscending, _ Header:=xlGuess, OrderCustom:=1, MatchCase:=False, _ Orientation:=xlTopToBottom, DataOption1:=xlSortNormal
End Sub
When the click the button a user form appears where the select the information field to sort the list by....I am having a problem when it comes to sorting the projects by the date.
The problem is that when is sorts by the date it doesn't completely work. Specifically, it does not know what to do with blanks as they are randomly distributed down the rows and the dates end up not being sorted in ascending order at all.
When I do this manually it works just fine.......Any suggestions, code is below
:banghead: .
sub sort()
Worksheets("Project List").Range("A3:CL65536").Select
Selection.Sort Key1:=Range("X3"), Order1:=xlAscending, _ Header:=xlGuess, OrderCustom:=1, MatchCase:=False, _ Orientation:=xlTopToBottom, DataOption1:=xlSortNormal
End Sub