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