LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default Simple MultiColumn Sorting

Hi again,

The effected area should be within range("A3:X52"). But the main target
column to sort the area is Column "X" while Column "J,K,L,M,N,O,P,Q,R,A" are
the next sort order (This is the rules).

The following are an exact example that the macro should accomplished the
sort order.

A B C J K L M N O P
Q R X

2 01 James 6 5 5 5 5 5
5 5 5 46
2 02 David 5 6 5 5 5 5
5 5 5 46
2 03 Harry 5 5 6 5 5 5
5 5 5 46
2 04 Steve 5 5 5 6 5 5
5 5 5 46
2 05 Peter 5 5 5 5 6 5
5 5 5 46
2 06 Jack 5 5 5 5 5 6
5 5 5 46
2 07 Jacky 5 5 5 5 5 5
6 5 5 46
2 08 Philip 5 5 5 5 5 5
5 6 5 46
2 09 Mike 5 5 5 5 5 5
5 5 6 46
5 10 George 5 5 5 5 5 5
5 5 5 45
3 11 Garry 5 5 5 5 5 5
5 5 5 45
2 12 Kent 5 5 5 5 5 5
5 5 5 45

To do that kind of job, I've recorded a macros and then manipulated them as
in the
following sub:-

Sub MultiColumn_Sorting()
Application.ScreenUpdating = False
Range("A3:X52").Select

Selection.Sort _
Key1:=Range("X3"), Order1:=xlDescending, _
Key2:=Range("A3"), Order2:=xlDescending, _
Header:=xlGuess, OrderCustom:=1, _
MatchCase:=False, Orientation:=xlTopToBottom

Selection.Sort _
Key1:=Range("X3"), Order1:=xlDescending, _
Key2:=Range("Q3"), Order2:=xlDescending, _
Key3:=Range("R3"), Order3:=xlDescending, _
Header:=xlGuess, OrderCustom:=1, _
MatchCase:=False, Orientation:=xlTopToBottom

Selection.Sort _
Key1:=Range("X3"), Order1:=xlDescending, _
Key2:=Range("P3"), Order2:=xlDescending, _
Key3:=Range("Q3"), Order3:=xlDescending, _
Header:=xlGuess, OrderCustom:=1, _
MatchCase:=False, Orientation:=xlTopToBottom

Selection.Sort _
Key1:=Range("X3"), Order1:=xlDescending, _
Key2:=Range("O3"), Order2:=xlDescending, _
Key3:=Range("P3"), Order3:=xlDescending, _
Header:=xlGuess, OrderCustom:=1, _
MatchCase:=False, Orientation:=xlTopToBottom

Selection.Sort _
Key1:=Range("X3"), Order1:=xlDescending, _
Key2:=Range("N3"), Order2:=xlDescending, _
Key3:=Range("O3"), Order3:=xlDescending, _
Header:=xlGuess, OrderCustom:=1, _
MatchCase:=False, Orientation:=xlTopToBottom

Selection.Sort _
Key1:=Range("X3"), Order1:=xlDescending, _
Key2:=Range("M3"), Order2:=xlDescending, _
Key3:=Range("N3"), Order3:=xlDescending, _
Header:=xlGuess, OrderCustom:=1, _
MatchCase:=False, Orientation:=xlTopToBottom

Selection.Sort _
Key1:=Range("X3"), Order1:=xlDescending, _
Key2:=Range("L3"), Order2:=xlDescending, _
Key3:=Range("M3"), Order3:=xlDescending, _
Header:=xlGuess, OrderCustom:=1, _
MatchCase:=False, Orientation:=xlTopToBottom

Selection.Sort _
Key1:=Range("X3"), Order1:=xlDescending, _
Key2:=Range("K3"), Order2:=xlDescending, _
Key3:=Range("L3"), Order3:=xlDescending, _
Header:=xlGuess, OrderCustom:=1, _
MatchCase:=False, Orientation:=xlTopToBottom

Selection.Sort _
Key1:=Range("X3"), Order1:=xlDescending, _
Key2:=Range("J3"), Order2:=xlDescending, _
Key3:=Range("K3"), Order3:=xlDescending, _
Header:=xlGuess, OrderCustom:=1, _
MatchCase:=False, Orientation:=xlTopToBottom
End Sub




 
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
Simple question on Sorting jlacap Excel Discussion (Misc queries) 5 October 5th 08 10:34 AM
automatically sorting a simple list cbguy Excel Discussion (Misc queries) 2 March 23rd 07 06:04 PM
MultiColumn ComboBox Paul Smith[_3_] Excel Programming 2 August 3rd 05 06:36 AM
display multicolumn box Alen32 Excel Programming 1 March 12th 05 05:00 PM
Multicolumn Combo Box PokerDude Excel Programming 2 January 29th 04 04:02 PM


All times are GMT +1. The time now is 04:56 PM.

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

About Us

"It's about Microsoft Excel"