Thread: Syntex Error ??
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
swatsp0p
 
Posts: n/a
Default Syntex Error ??


You don't indicate what kind of failure you are getting (not working at
all, unexpected results, etc.), but: Range("A1").CurrentRegion.Sort
Key1:=Range("F2"), Your range starts in A1, your sort key starts in F2.
Try F1?

This code is tested and works for a multiple level sort...


Code:
--------------------
Range("A1").Select
Range(Selection, Selection.End(xlDown)).Select
Range(Selection, Selection.End(xlToRight)).Select
Selection.Sort Key1:=Range("A1"), Order1:=xlAscending, Key2:=Range("E4") _
, Order2:=xlAscending, Key3:=Range("F4"), Order3:=xlAscending, HEADER:= _
xlGuess, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal, DataOption2:=xlSortNormal, DataOption3:= _
xlSortNormal
--------------------

This selects all contiguous rows/columns with data from A1 down and
over... then sorts by Cols. A, E and F.

good luck


--
swatsp0p


------------------------------------------------------------------------
swatsp0p's Profile: http://www.excelforum.com/member.php...o&userid=15101
View this thread: http://www.excelforum.com/showthread...hreadid=491797