Variable not Defined Error for Sorting Excel: 2000

S

Shazi

Hi,

I prepared a function for Sorting a Data. its working in Excel 2003,
but not working in Excel 2000, I dont know why.

The Error messge is appearing (Compile Error, Variable not Defined.)


Sub SortBy_Company()

Sheets("Data").Select
Range("B7:I2000").Select

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

Range("B6").Activate

End Sub

please help me out.

Regards

Shahzad
 
C

Chip Pearson

I believe that the DataOption1 parameter doesn't exist in Excel 2000. When
code is going to be used in different versions of Excel, you must code for
the earliest version of Excel to be supported.


--
Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)
 
S

Shazi

I believe that the DataOption1 parameter doesn't exist in Excel 2000. When
code is going to be used in different versions of Excel, you must code for
the earliest version of Excel to be supported.

--
Cordially,
Chip Pearson
Microsoft Most Valuable Professional
    Excel Product Group
Pearson Software Consulting, LLCwww.cpearson.com
(email on web site)














- Show quoted text -

Hi,

Thank you for your support, I will change the code as of Excel 2000.

Regards.

Shahzad
 

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