Hi all
I have some code that creates and sorts a sheet as per a whole lot of code, including sort.
Is there a way to prioritise sort? At the moment the sort order is as per the code below. It doesn't really sort as it should. At the moment it groups on some of them but not over all.
I need it to put all column A (date) together, of that group all of column F (condition) together then sorted by D (order) and E (sub order). Bit hard to explain but the result is all the same date, then all the same condition together, then that condition sorted by order then sub order.
Make sense?
ActiveWorkbook.Worksheets("XXX").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("XXX").Sort.SortFields.Add Key:=Range( _
"A2:A10000"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _
xlSortTextAsNumbers
ActiveWorkbook.Worksheets("XXX").Sort.SortFields.Add Key:=Range( _
"F2:F10000"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _
xlSortNormal
ActiveWorkbook.Worksheets("XXX").Sort.SortFields.Add Key:=Range( _
"D2:D10000"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _
xlSortNormal
ActiveWorkbook.Worksheets("XXX").Sort.SortFields.Add Key:=Range( _
"E2:E10000"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _
xlSortNormal
Bookmarks