Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
Syntex Error ??
Would someone mind heaving a look at this segment of code and letting me know if they can see whats wrong with it please. Many thanks Paul 'Sort by ID number Range("A1").CurrentRegion.Sort Key1:=Range("F2"), Order1:=xlAscending, Header:=xlYes, _ Orientation:=xlTopToBottom -- Paul Cooke ------------------------------------------------------------------------ Paul Cooke's Profile: http://www.excelforum.com/member.php...o&userid=29268 View this thread: http://www.excelforum.com/showthread...hreadid=491797 |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
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 |
#3
Posted to microsoft.public.excel.misc
|
|||
|
|||
Syntex Error ??
Paul,
You haven't got a space and an underscore character at the end of the first line... I think! regards Pete "Paul Cooke" wrote: Would someone mind heaving a look at this segment of code and letting me know if they can see whats wrong with it please. Many thanks Paul 'Sort by ID number Range("A1").CurrentRegion.Sort Key1:=Range("F2"), Order1:=xlAscending, Header:=xlYes, _ Orientation:=xlTopToBottom -- Paul Cooke ------------------------------------------------------------------------ Paul Cooke's Profile: http://www.excelforum.com/member.php...o&userid=29268 View this thread: http://www.excelforum.com/showthread...hreadid=491797 |
#4
Posted to microsoft.public.excel.misc
|
|||
|
|||
Syntex Error ??
Hi Many thanks for your reply, your code has solved the problem and works great. Thanks again for taking the time to reply Best regards Paul -- Paul Cooke ------------------------------------------------------------------------ Paul Cooke's Profile: http://www.excelforum.com/member.php...o&userid=29268 View this thread: http://www.excelforum.com/showthread...hreadid=491797 |
#5
Posted to microsoft.public.excel.misc
|
|||
|
|||
Syntex Error ??
I'm glad it worked for you. Thanks for the feedback, it is always appreciated. Cheers! -- swatsp0p ------------------------------------------------------------------------ swatsp0p's Profile: http://www.excelforum.com/member.php...o&userid=15101 View this thread: http://www.excelforum.com/showthread...hreadid=491797 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Ignore error msgs in formula references | Excel Discussion (Misc queries) | |||
Error trapped only while stepping through the code - Not triggered when run | Excel Discussion (Misc queries) | |||
Error trapped only while stepping through the code - Not triggered when run | Excel Discussion (Misc queries) | |||
Problem with VBA returning the contents of a long formula. | Excel Discussion (Misc queries) | |||
ERROR | Excel Discussion (Misc queries) |