Thread: 6 column sort
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Jose Smith Jose Smith is offline
external usenet poster
 
Posts: 2
Default 6 column sort

Hi,
In my routine job, I need sort function that could sort data in 6 different
column.
Excel have only sort function with 3 different column.
So I look on excel VBA macro to create this function.
Before I go further to create this function, I just wonder if someone had
already done this ?
Or is there any other way to manipulate existing sort function ?
I will appreciate any direction.

I first attemp is used "Selection.sort" function.
The coding as follow:

Selection.Sort Key1:=Range(ComboBox1.Text), Order1:=xlAscending,
Key2:=Range(ComboBox2.Text) _
, Order2:=xlAscending, Key3:=Range(ComboBox3.Text),
Order3:=xlAscending, _
Header:=xlYes, MatchCase:=True, Orientation:=xlSortColumns

Then I tried to append Range with other column input, but do not work:
Selection.Sort Key1:=Range(ComboBox1.Text)&Range(ComboBox4.Text),
Order1:=xlAscending, Key2:=Range(ComboBox2.Text))&Range(ComboBox5.Text) ,
Order2:=xlAscending, Key3:=Range(ComboBox3.Text))&Range(ComboBox6.Text) ,
Order3:=xlAscending, _
Header:=xlYes, MatchCase:=True, Orientation:=xlSortColumns

I will appreciate any direction.

cruesoe137