SORT not working

W

WLMPilot

On a different computer than my own, I created two sort routines via RECORD
MACRO. I then created a Command Button, copied & pasted the sort routine to
its appropriate command button. On the other computer, these routines worked
fine. However, when I loaded the Excel file onto my computer the routines do
not work.

I have other command buttons that continue to work properly on both computers.
I use MS Office 2000 Premium. I have not checked the version I used on the
other computer. However, since I used the "record" feature, I figured it
would be the same.

Here are both routines. The area that gets highlighted when I click on
debug is the
section that begins with "Selection.Sort" and ends with ":=xlSortNormal"

Private Sub CommandButton15_Click()
Range("A6:M48").Select
Selection.Sort Key1:=Range("C6"), Order1:=xlAscending, Key2:=Range("A6") _
, Order2:=xlAscending, Header:=xlGuess, OrderCustom:=1, MatchCase:= _
False, Orientation:=xlTopToBottom, DataOption1:=xlSortNormal,
DataOption2 _
:=xlSortNormal
Range("A6").Select
End Sub

Private Sub CommandButton16_Click()
Range("A6:M48").Select
Selection.Sort Key1:=Range("A6"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
ActiveWindow.SmallScroll Down:=-18
Range("A13:M48").Select
Selection.Sort Key1:=Range("C13"), Order1:=xlAscending,
Key2:=Range("A13" _
), Order2:=xlAscending, Header:=xlGuess, OrderCustom:=1, MatchCase:= _
False, Orientation:=xlTopToBottom, DataOption1:=xlSortNormal,
DataOption2 _
:=xlSortNormal
Range("A6").Select
End Sub

Any help is appreciated,
Les
 
J

Jim Cone

Les,

From the xl2000 help? file...
"expression.Sort(Key1, Order1, Key2, Type, Order2, Key3, Order3, Header, OrderCustom, MatchCase, Orientation, SortMethod)"

Note that there is no "DataOption" argument.
You should remove that section from your code.
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware



"WLMPilot" <[email protected]>
wrote in message
On a different computer than my own, I created two sort routines via RECORD
MACRO. I then created a Command Button, copied & pasted the sort routine to
its appropriate command button. On the other computer, these routines worked
fine. However, when I loaded the Excel file onto my computer the routines do
not work.

I have other command buttons that continue to work properly on both computers.
I use MS Office 2000 Premium. I have not checked the version I used on the
other computer. However, since I used the "record" feature, I figured it
would be the same.

Here are both routines. The area that gets highlighted when I click on
debug is the
section that begins with "Selection.Sort" and ends with ":=xlSortNormal"

Private Sub CommandButton15_Click()
Range("A6:M48").Select
Selection.Sort Key1:=Range("C6"), Order1:=xlAscending, Key2:=Range("A6") _
, Order2:=xlAscending, Header:=xlGuess, OrderCustom:=1, MatchCase:= _
False, Orientation:=xlTopToBottom, DataOption1:=xlSortNormal,
DataOption2 _
:=xlSortNormal
Range("A6").Select
End Sub

Private Sub CommandButton16_Click()
Range("A6:M48").Select
Selection.Sort Key1:=Range("A6"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
ActiveWindow.SmallScroll Down:=-18
Range("A13:M48").Select
Selection.Sort Key1:=Range("C13"), Order1:=xlAscending,
Key2:=Range("A13" _
), Order2:=xlAscending, Header:=xlGuess, OrderCustom:=1, MatchCase:= _
False, Orientation:=xlTopToBottom, DataOption1:=xlSortNormal,
DataOption2 _
:=xlSortNormal
Range("A6").Select
End Sub

Any help is appreciated,
Les
 

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