Sorting problem in a macro

  • Thread starter Thread starter jonco
  • Start date Start date
J

jonco

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
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top