Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / January 2007

Tip: Looking for answers? Try searching our database.

Sort more than 3 columns + choose ascending or descending

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Nader - 26 Jan 2007 09:45 GMT
Hello,

I have a small problem ... I would like to sort more than 3 columns
(actually as much as I want) in excel using vba programming. In the same, I
would need to be able to choose if a column should be sorted  ascending or
descending.

I already found a solution on the internet for sorting more than 3 columns :
it's to concatenate all the columns I want to sort and then sort that
columns but in that case I cannot choose to sort each column ascending or
descending....

Thanks in advance for your help.

Nader
Niek Otten - 26 Jan 2007 10:16 GMT
Hi Nader,

From Excel online Help:

Sort rows by four criteria (columns)
 1.. Click a cell in the range you want to sort.
 2.. On the Data menu, click Sort.
 3.. In the first Sort by box click the column of least importance.
 4.. Click OK.
 5.. On the Data menu, click Sort.
 6.. In the Sort by and Then by boxes, click the other three columns you want to sort, starting with the most important.
 7.. Select any other sort options you want, and then click OK.
Record these actions in a macro and change where necessary

Signature

Kind regards,

Niek Otten
Microsoft MVP - Excel

| Hello,
|
[quoted text clipped - 11 lines]
|
| Nader
Nader - 26 Jan 2007 10:22 GMT
Hi Niek,

Thank you for taking time to reply to my post but unfortunately it only
works for 4 columns.
In my case, I need to sort more than 3 columns but that I mean that one time
it could be 3 columns another time 10 columns. So, I was looking for
something flexible in vba or excel formula ...

Thanks a lot.

> Hi Nader,
>
[quoted text clipped - 30 lines]
> |
> | Nader
Dave Peterson - 26 Jan 2007 16:08 GMT
You can sort by as many columns as you want--just 3 at a time.

In xl2003, you can apply data|filter|autofilter to the range and use the
dropdown arrow to sort your data.

Debra Dalgleish has a technique at her site that adds invisible rectangles in
the headers and then sorts the data by that field when you click on one of those
rectangles.

http://contextures.com/xlSort02.html

If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

> Hi Niek,
>
[quoted text clipped - 46 lines]
> > |
> > | Nader

Signature

Dave Peterson

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.