Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 53
Default Sorting problem in a macro

I have a sorting macro that runs on a machine with Excel 2003 but won't run
on Excel 2000. I used the macro recorder to record the macro but it won't
run on the machine with Excel 2000. Is there some change I could make to
the sorting routine that would make it compatible with both versions of
Excel?

The line between the asterisks below is the one that stops during execution
of the macro.


Range("M3:N122").Select ' Select all records in list to sort
****
Selection.Sort Key1:=Range("N3"), Order1:=xlAscending,
Header:=xlGuess,OrderCustom:=1, MatchCase:=False,
Orientation:=xlTopToBottom, DataOption1:=xlSortNormal
****

Also, do I need all those variables in the macro... like Header MatchCase,
Orientation...etc. All I ewant it to do is sort alphabetically on the
contents in column N .

Any help would be appreciated.
Jonco


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Sorting problem in a macro

Hi Jonco,

The DataOption1 argument is not available in xl2k, so try changing your code
to:

Selection.Sort Key1:=Range("N3"), _
Order1:=xlAscending, _
Header:=xlGuess, OrderCustom:=1, _
MatchCase:=False, _
Orientation:=xlTopToBottom


---
Regards,
Norman


"jonco" wrote in message
. com...
I have a sorting macro that runs on a machine with Excel 2003 but won't run
on Excel 2000. I used the macro recorder to record the macro but it won't
run on the machine with Excel 2000. Is there some change I could make to
the sorting routine that would make it compatible with both versions of
Excel?

The line between the asterisks below is the one that stops during
execution of the macro.


Range("M3:N122").Select ' Select all records in list to sort
****
Selection.Sort Key1:=Range("N3"), Order1:=xlAscending,
Header:=xlGuess,OrderCustom:=1, MatchCase:=False,
Orientation:=xlTopToBottom, DataOption1:=xlSortNormal
****

Also, do I need all those variables in the macro... like Header MatchCase,
Orientation...etc. All I ewant it to do is sort alphabetically on the
contents in column N .

Any help would be appreciated.
Jonco



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
sorting problem Jack Sons Excel Discussion (Misc queries) 3 June 19th 08 11:07 PM
Sorting problem . . . Hubitron2000 Excel Discussion (Misc queries) 1 March 20th 06 08:40 PM
Sorting problem man Excel Discussion (Misc queries) 1 December 8th 05 10:36 AM
Sticky sorting/macro/VLOOKUP problem Ron M. Excel Discussion (Misc queries) 1 October 20th 05 07:56 PM
Sorting problem broogle Excel Programming 2 April 14th 05 06:51 AM


All times are GMT +1. The time now is 09:57 AM.

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

About Us

"It's about Microsoft Excel"