Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default Sort on 2 Custom Lists

Hi all, I am trying to sort data by Column A first, and then Column B. Both
columns are custom lists. I tried this code but it will only read my custom
sort for Column A. Column B is sorted alphabetically ascending, not sorted
by my custom list. Any ideas? (the header will be "yes" later...that's why
it's there...)

Private Sub Workbook_Open()
Worksheets("Sheet1").Select
Cells.Select
Selection.Sort Key1:=Range("A1"), OrderCustom:=7, header:=xlNo, _
Key2:=Range("B1"), OrderCustom:=6, header:=xlNo
Sheet1.Activate
Range("A1").Select
Range("A1").Activate
End Sub

Thanks!
Cheryl
--
carusso
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,549
Default Sort on 2 Custom Lists

Only one custom sort order is recognized per sort.
Run two separate sorts (using all data columns) - sort Column B then sort Column A.
--
Jim Cone
Portland, Oregon USA



"carusso"

wrote in message
Hi all, I am trying to sort data by Column A first, and then Column B. Both
columns are custom lists. I tried this code but it will only read my custom
sort for Column A. Column B is sorted alphabetically ascending, not sorted
by my custom list. Any ideas? (the header will be "yes" later...that's why
it's there...)

Private Sub Workbook_Open()
Worksheets("Sheet1").Select
Cells.Select
Selection.Sort Key1:=Range("A1"), OrderCustom:=7, header:=xlNo, _
Key2:=Range("B1"), OrderCustom:=6, header:=xlNo
Sheet1.Activate
Range("A1").Select
Range("A1").Activate
End Sub

Thanks!
Cheryl
--
carusso
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default Sort on 2 Custom Lists

great....thanks for the info. (I couldn't find that anywhere!)
--
carusso


"Jim Cone" wrote:

Only one custom sort order is recognized per sort.
Run two separate sorts (using all data columns) - sort Column B then sort Column A.
--
Jim Cone
Portland, Oregon USA



"carusso"

wrote in message
Hi all, I am trying to sort data by Column A first, and then Column B. Both
columns are custom lists. I tried this code but it will only read my custom
sort for Column A. Column B is sorted alphabetically ascending, not sorted
by my custom list. Any ideas? (the header will be "yes" later...that's why
it's there...)

Private Sub Workbook_Open()
Worksheets("Sheet1").Select
Cells.Select
Selection.Sort Key1:=Range("A1"), OrderCustom:=7, header:=xlNo, _
Key2:=Range("B1"), OrderCustom:=6, header:=xlNo
Sheet1.Activate
Range("A1").Select
Range("A1").Activate
End Sub

Thanks!
Cheryl
--
carusso

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default Sort on 2 Custom Lists

OK, I thought I could figure this out...but not. I really don't know VBA,
just do a lot of copying and pasting and modifying. So can you please let me
know how to code 2 separate sorts.
Thanks!
--
carusso


"Jim Cone" wrote:

Only one custom sort order is recognized per sort.
Run two separate sorts (using all data columns) - sort Column B then sort Column A.
--
Jim Cone
Portland, Oregon USA



"carusso"

wrote in message
Hi all, I am trying to sort data by Column A first, and then Column B. Both
columns are custom lists. I tried this code but it will only read my custom
sort for Column A. Column B is sorted alphabetically ascending, not sorted
by my custom list. Any ideas? (the header will be "yes" later...that's why
it's there...)

Private Sub Workbook_Open()
Worksheets("Sheet1").Select
Cells.Select
Selection.Sort Key1:=Range("A1"), OrderCustom:=7, header:=xlNo, _
Key2:=Range("B1"), OrderCustom:=6, header:=xlNo
Sheet1.Activate
Range("A1").Select
Range("A1").Activate
End Sub

Thanks!
Cheryl
--
carusso

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,549
Default Sort on 2 Custom Lists

Two separate sorts, different key column and custom order in each...
'--
Sub MixEmUp()
Selection.Sort key1:=Range("B1"), ordercustom:=6, header:=xlNo, _
MatchCase:=False, Orientation:=xlTopToBottom
Selection.Sort key1:=Range("A1"), ordercustom:=7, header:=xlNo, _
MatchCase:=False, Orientation:=xlTopToBottom
End Sub
'--
The last sort determines the overall order of the data.
Jim Cone
Portland, Oregon USA



"carusso"
wrote in message
OK, I thought I could figure this out...but not. I really don't know VBA,
just do a lot of copying and pasting and modifying.
So can you please let me know how to code 2 separate sorts.
Thanks!
--
carusso


  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default Sort on 2 Custom Lists

ahhh..I still can't get it to work. Where exactly does your code go within
my code:

Private Sub Workbook_Open()
Worksheets("Sheet1").Select
Cells.Select
Selection.Sort Key1:=Range("A1"), OrderCustom:=7, header:=xlNo, _
Key2:=Range("B1"), OrderCustom:=6, header:=xlNo
Sheet1.Activate
Range("A1").Select
Range("A1").Activate
End Sub

Clueless Cheryl in VBA Land...
--
carusso


"Jim Cone" wrote:

Two separate sorts, different key column and custom order in each...
'--
Sub MixEmUp()
Selection.Sort key1:=Range("B1"), ordercustom:=6, header:=xlNo, _
MatchCase:=False, Orientation:=xlTopToBottom
Selection.Sort key1:=Range("A1"), ordercustom:=7, header:=xlNo, _
MatchCase:=False, Orientation:=xlTopToBottom
End Sub
'--
The last sort determines the overall order of the data.
Jim Cone
Portland, Oregon USA



"carusso"
wrote in message
OK, I thought I could figure this out...but not. I really don't know VBA,
just do a lot of copying and pasting and modifying.
So can you please let me know how to code 2 separate sorts.
Thanks!
--
carusso

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default Sort on 2 Custom Lists

hold on....I finally got it to work....hallelujah! ;-) Thanks!
--
carusso


"Jim Cone" wrote:

Two separate sorts, different key column and custom order in each...
'--
Sub MixEmUp()
Selection.Sort key1:=Range("B1"), ordercustom:=6, header:=xlNo, _
MatchCase:=False, Orientation:=xlTopToBottom
Selection.Sort key1:=Range("A1"), ordercustom:=7, header:=xlNo, _
MatchCase:=False, Orientation:=xlTopToBottom
End Sub
'--
The last sort determines the overall order of the data.
Jim Cone
Portland, Oregon USA



"carusso"
wrote in message
OK, I thought I could figure this out...but not. I really don't know VBA,
just do a lot of copying and pasting and modifying.
So can you please let me know how to code 2 separate sorts.
Thanks!
--
carusso

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
custom lists and custom formulas? nameruc Excel Discussion (Misc queries) 0 December 6th 06 04:18 PM
Custom lists (XP) Hans Knudsen Excel Discussion (Misc queries) 9 October 4th 06 06:44 PM
Saving Sort Criteria (or Sort Lists) Jim J. Excel Worksheet Functions 1 July 25th 06 10:55 AM
Custom Lists Natasha Excel Discussion (Misc queries) 3 April 26th 06 04:17 PM
Excel sort by Fill Color by custom list sort Dash4Cash Excel Discussion (Misc queries) 2 July 29th 05 10:45 PM


All times are GMT +1. The time now is 06:31 PM.

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"