Macro works in 2003, not in '97

C

CLR

Sorry, no title on previous one............

Hi All..........

I recorded this macro in XL03 and it works fine, in mine, and another 03,
but crashes in two different XL97's on the line starting with
"Selection".........yet other macros in the same book work ok on those
97's.......


Sub SortByWorkorder()

Range("A13").Select
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Sort Key1:=Range("D14"), Order1:=xlAscending, Header:=xlGuess,
_
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
Range("a14").Select
Range("D11").Select
End Sub

any advice will be appreciated.........

Vaya con Dios,
Chuck, CABGx3
 
J

Jim Rech

DataOption1 was introduced after Excel 97. Your code will probably work
okay if you get rid of it.

When you're developing for cross-version use, it's best to work in the
lowest version.

--
Jim Rech
Excel MVP

| Sorry, no title on previous one............
|
| Hi All..........
|
| I recorded this macro in XL03 and it works fine, in mine, and another 03,
| but crashes in two different XL97's on the line starting with
| "Selection".........yet other macros in the same book work ok on those
| 97's.......
|
|
| Sub SortByWorkorder()
|
| Range("A13").Select
| Range(Selection, Selection.End(xlToRight)).Select
| Range(Selection, Selection.End(xlDown)).Select
| Selection.Sort Key1:=Range("D14"), Order1:=xlAscending,
Header:=xlGuess,
| _
| OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
| DataOption1:=xlSortNormal
| Range("a14").Select
| Range("D11").Select
| End Sub
|
| any advice will be appreciated.........
|
| Vaya con Dios,
| Chuck, CABGx3
|
|
 
C

CLR

Thanks Jim.............but I have no clue as to what "Data Option 1" is,
nor how to get rid of it. Would you be so kind as to elaborate?............

I agree about the developing in the enduser's version, however the company I
work for will only provide one version per user. And, there are four users
of this file, two with 2003 and two with 97.


Thanks again,
Vaya con Dios,
Chuck, CABGx3
 
J

Jim Rech

Just delete it from your code. The line will then read:

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

--
Jim Rech
Excel MVP
| Thanks Jim.............but I have no clue as to what "Data Option 1" is,
| nor how to get rid of it. Would you be so kind as to
elaborate?............
|
| I agree about the developing in the enduser's version, however the company
I
| work for will only provide one version per user. And, there are four
users
| of this file, two with 2003 and two with 97.
|
|
| Thanks again,
| Vaya con Dios,
| Chuck, CABGx3
|
|
|
|
| | > DataOption1 was introduced after Excel 97. Your code will probably work
| > okay if you get rid of it.
| >
| > When you're developing for cross-version use, it's best to work in the
| > lowest version.
| >
| > --
| > Jim Rech
| > Excel MVP
| >
| > | > | Sorry, no title on previous one............
| > |
| > | Hi All..........
| > |
| > | I recorded this macro in XL03 and it works fine, in mine, and another
| 03,
| > | but crashes in two different XL97's on the line starting with
| > | "Selection".........yet other macros in the same book work ok on those
| > | 97's.......
| > |
| > |
| > | Sub SortByWorkorder()
| > |
| > | Range("A13").Select
| > | Range(Selection, Selection.End(xlToRight)).Select
| > | Range(Selection, Selection.End(xlDown)).Select
| > | Selection.Sort Key1:=Range("D14"), Order1:=xlAscending,
| > Header:=xlGuess,
| > | _
| > | OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
| > | DataOption1:=xlSortNormal
| > | Range("a14").Select
| > | Range("D11").Select
| > | End Sub
| > |
| > | any advice will be appreciated.........
| > |
| > | Vaya con Dios,
| > | Chuck, CABGx3
| > |
| > |
| >
| >
|
|
 
C

CLR

OIC.........duh, .......I thought you were talking about something else
<blush>..........I'll give it a try in the morning at work as I don't have
'97 here at home........

Thanks again,
Vaya con Dios,
Chuck, CABGx3
 
C

CLR

Thanks again Jim.........I made your recommended change this morning and it
works "finer than frog hair"........

Vaya con Dios,
Chuck, CABGx3
 
Top