I am trying to develop a sort that will sort two columns if one condition is met and another sort if another condition is met. When the sort completes I get some cells in column E that are blank. Also in column E the order is not ascending. I thought the line If a > 0 would cause the sort to skip this sort if the cell had a number in it. Any help would be greatly appreciated.
Tom
Column E
1
1
2
2
3
3
3
4
4
4
5.2
4.0
blank
5.2
6.2
blank
4.0
Tom
Column E
1
1
2
2
3
3
3
4
4
4
5.2
4.0
blank
5.2
6.2
blank
4.0
Code:
lic Sub SortDec()
Dim a As Range
Dim c As Range
Dim d As Range
Dim e As Range
For Each a In Worksheets("ClientProcessing").Range("E9:E99")
If a > 0 Then
'3 key sort
Selection.Sort Key1:=Range("E9"), Order1:=xlAscending, Key2:=Range("A9") _
, Order2:=xlAscending, Key3:=Range("J9"), Order3:=xlAscending, _
Header:=xlYes, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal, DataOption2:=xlSortNormal
Else
'2 key sort
Selection.Sort Key1:=Range("C9"), Order1:=xlAscending, Key2:=Range("A9") _
, Order2:=xlAscending, _
Header:=xlYes, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal, DataOption2:=xlSortNormal
End If
Next