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 |
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 |
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 |
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 |
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 |
All times are GMT +1. The time now is 08:02 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com