Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
can't sort a list
I'm using the following code in excel 2003 trying to sort a column of text
values: ActiveWorkbook.Sheets("cost sheet").Range("a100:a200").Select Selection.Sort Key1:=Range("a100"), Order1:=xlDescending, Header:=xlNo, _ OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom I get an error: "Sort reference is not valid. make sure it's withing the data ou want to sort and the first sort by box isn't the same or blank. Most of the cells are blank and all are formatted as text. Any help would be appreciated |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
can't sort a list
I'm gonna guess that it's that unqualified range object:
Selection.Sort Key1:=Range("a100"), .... should be: Selection.Sort Key1:=ActiveWorkbook.Sheets("cost sheet").Range("a100") Or without selecting... with ActiveWorkbook.Sheets("cost sheet").Range("a100:a200") .Sort Key1:=.columns(1), Order1:=xlDescending, Header:=xlNo, _ OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom end with bigjim wrote: I'm using the following code in excel 2003 trying to sort a column of text values: ActiveWorkbook.Sheets("cost sheet").Range("a100:a200").Select Selection.Sort Key1:=Range("a100"), Order1:=xlDescending, Header:=xlNo, _ OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom I get an error: "Sort reference is not valid. make sure it's withing the data ou want to sort and the first sort by box isn't the same or blank. Most of the cells are blank and all are formatted as text. Any help would be appreciated -- Dave Peterson |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
can't sort a list
that was it. thanks
Jim "Dave Peterson" wrote: I'm gonna guess that it's that unqualified range object: Selection.Sort Key1:=Range("a100"), .... should be: Selection.Sort Key1:=ActiveWorkbook.Sheets("cost sheet").Range("a100") Or without selecting... with ActiveWorkbook.Sheets("cost sheet").Range("a100:a200") .Sort Key1:=.columns(1), Order1:=xlDescending, Header:=xlNo, _ OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom end with bigjim wrote: I'm using the following code in excel 2003 trying to sort a column of text values: ActiveWorkbook.Sheets("cost sheet").Range("a100:a200").Select Selection.Sort Key1:=Range("a100"), Order1:=xlDescending, Header:=xlNo, _ OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom I get an error: "Sort reference is not valid. make sure it's withing the data ou want to sort and the first sort by box isn't the same or blank. Most of the cells are blank and all are formatted as text. Any help would be appreciated -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
I want sort a list but the sort is unlit on the home tab how do I | Excel Worksheet Functions | |||
Code to automatically sort a list, each time that a new entry isadded to the bottom of the list | Excel Programming | |||
Excel sort by Fill Color by custom list sort | Excel Discussion (Misc queries) | |||
sort list of players by team from player list on separate sheet | Excel Worksheet Functions | |||
Can you sort a list based on catagory names without useing a custom list? | Excel Programming |