ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Variable not Defined Error for Sorting Excel: 2000 (https://www.excelbanter.com/excel-programming/414555-variable-not-defined-error-sorting-excel-2000-a.html)

Shazi

Variable not Defined Error for Sorting Excel: 2000
 
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

Chip Pearson

Variable not Defined Error for Sorting Excel: 2000
 
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)




"Shazi" wrote in message
...
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



Shazi

Variable not Defined Error for Sorting Excel: 2000
 
On Jul 24, 9:04*pm, "Chip Pearson" wrote:
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)

"Shazi" wrote in message

...



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- Hide quoted text -


- Show quoted text -


Hi,

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

Regards.

Shahzad


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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com