Sorting problem

  • Thread starter Francis Hookham
  • Start date
F

Francis Hookham

Any idea why the following runs on laptop with XL 2002 but not on desktop
with XL 2000.

It is in a subroutine called by another. The sub does not start but throws
up the comment 'Named argument cannot be found' and 'DataOption1' is
highlighted?



Range("A1:D" & iCount).Sort Key1:=Range("C1"), Order1:=xlAscending,
Header:=xlGuess, OrderCustom:=1, MatchCase:=False,
Orientation:=xlTopToBottom, DataOption1:=xlSortNormal



Francis Hookham
 
D

Dave Peterson

Remove this portion: ", DataOption1:=xlSortNormal"

This option was added in xl2002.
 
C

Chip Pearson

Francis,

The 'DataOption1' sort option was added with Excel 2002. It is not
recognized by earlier versions. When you are working with multiple versions
of Excel, you must be sure you code for the earliest version. Otherwise, as
you have seen, the code may not work.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting
www.cpearson.com
(email on the web site)
 
F

Francis Hookham

Many thanks Chip and Dave

I do most of the programming in 2002 on the Laptop (it is newer and much
faster!) but, now I understand the problem I'll remove similar offending
code if it occurs and chack the macro still runs correctly.

Francis
 

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

Top