Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How can I delete rows programmatically based on certain criteria? nt_artagnian[_2_] New Users to Excel 2 March 8th 07 03:56 AM
How can I delete rows programmatically based on certain criteria? nt_artagnian[_2_] Excel Worksheet Functions 1 March 7th 07 05:48 PM
Deleting rows programmatically David Bateman Excel Worksheet Functions 1 March 6th 05 02:10 AM
Can i set a reference programmatically? Tom Ogilvy Excel Programming 1 August 19th 03 04:24 PM
programmatically insert multiple blank rows in worksheet tag Excel Programming 3 July 31st 03 05:03 AM


All times are GMT +1. The time now is 01:50 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"