Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Sorting rows programmatically
I have a range that I want to sort on a specific column.
There is a Sort method that does just what I want with one exception. I want to define a custom sort order that is not simply ascending or descending. Here is an example to show what I mean. Suppose I have a column called "Col A" that I want to sort on. Let's say the column can have values "A, B, or C", but I want to define the sort order as follows: B, C, A. In other words, I always show Bs, followed by Cs, followed by As. I thought about creating a "data table" on another sheet to specify this sort order, but I'm not sure if I can use the Sort method to do this. Auy thoughts? (Unsorted) Col A 1 A 2 B 3 C (Sorted using a custom sort order) Col A 1 B 2 C 3 A |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Sorting rows programmatically
You can create a custom sort order as a custom list (tools=Options =
customs lists). However, you can't specify B, C, A and have it sort Andy Bill Charles as Bill Charles Andy You would have to make a custom list Bill, Charles, Andy and then it would sort as you want. The sort command has an option to specify the list to use, just as you can do it manually using the options button in the sort dialog. -- Regards, Tom Ogilvy "Michael Monteiro" wrote in message ... I have a range that I want to sort on a specific column. There is a Sort method that does just what I want with one exception. I want to define a custom sort order that is not simply ascending or descending. Here is an example to show what I mean. Suppose I have a column called "Col A" that I want to sort on. Let's say the column can have values "A, B, or C", but I want to define the sort order as follows: B, C, A. In other words, I always show Bs, followed by Cs, followed by As. I thought about creating a "data table" on another sheet to specify this sort order, but I'm not sure if I can use the Sort method to do this. Auy thoughts? (Unsorted) Col A 1 A 2 B 3 C (Sorted using a custom sort order) Col A 1 B 2 C 3 A |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How can I delete rows programmatically based on certain criteria? | New Users to Excel | |||
How can I delete rows programmatically based on certain criteria? | Excel Worksheet Functions | |||
Deleting rows programmatically | Excel Worksheet Functions | |||
Can i set a reference programmatically? | Excel Programming | |||
programmatically insert multiple blank rows in worksheet | Excel Programming |