#1   Report Post  
Posted to microsoft.public.excel.misc
Paul Cooke
 
Posts: n/a
Default 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   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

  #3   Report Post  
Posted to microsoft.public.excel.misc
Peter Rooney
 
Posts: n/a
Default 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   Report Post  
Posted to microsoft.public.excel.misc
Paul Cooke
 
Posts: n/a
Default 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   Report Post  
Posted to microsoft.public.excel.misc
swatsp0p
 
Posts: n/a
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Ignore error msgs in formula references gharden Excel Discussion (Misc queries) 4 June 17th 05 12:14 AM
Error trapped only while stepping through the code - Not triggered when run Jeff Excel Discussion (Misc queries) 7 March 7th 05 06:29 PM
Error trapped only while stepping through the code - Not triggered when run Jeff Excel Discussion (Misc queries) 0 February 28th 05 06:26 PM
Problem with VBA returning the contents of a long formula. [email protected] Excel Discussion (Misc queries) 2 February 23rd 05 12:14 AM
ERROR Pinto1uk Excel Discussion (Misc queries) 1 February 8th 05 03:15 AM


All times are GMT +1. The time now is 02:02 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"