PDA

View Full Version : [SOLVED] Easy sort question



austenr
04-29-2005, 06:53 AM
I know I have seen this before but cannot find it. The following code runs in XP but causes a compile error when run in 97. The error is on the xlSortNormal. What is the correct way to make it cross version compatable?


Sub SortDataList() '\sorts the data list after new row is entered
With Range("DataBase").Parent
.Range("A2:D65536").Sort Key1:=.Range("A2"), Order1:=xlAscending, Header:=xlNo, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
End With
End Sub :help

Jacob Hilderbrand
04-29-2005, 07:20 AM
Just remove the DataOption1 Argument and it should work fine.

austenr
04-29-2005, 07:23 AM
ok thanks

Jacob Hilderbrand
04-29-2005, 08:48 AM
You're Welcome :beerchug:

Take Care

Zack Barresse
04-29-2005, 08:54 AM
This is all you need ...


Range("DataBase").Parent.Range("A2:D65536").Sort Range("DataBase").Parent.Range("A2")

The other stuff is default, no need to expressly call it.