Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Hi, I am trying to write a macro to do a custom sort. I have writen part of it which enters a custom list then it moves to the data I want to sort and it is supposed to sort it in the order of the custom list. My problem is I can't get the macro to choose my custom list which is at the bottom of the custom lists. Below is the code. Sheets("Customers").Select Range("A3").Select Selection.Sort Key1:=Range("A3"), Order1:=xlAscending, Header:=xlGuess, _ OrderCustom:=12, MatchCase:=False, Orientation:=xlTopToBottom Thanks. nb. Using Excel 97 James -- fugfug ------------------------------------------------------------------------ fugfug's Profile: http://www.excelforum.com/member.php...o&userid=24950 View this thread: http://www.excelforum.com/showthread...hreadid=386709 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
If you are creating the customlist on the fly, it will get added to the end.
Sheets("Customers").Select Range("A3").Select Selection.Sort Key1:=Range("A3"), Order1:=xlAscending, Header:=xlGuess, _ OrderCustom:=Application.CustomListCount, MatchCase:=False, Orientation:=xlTopToBottom I advise deleting it a=fterwards as well Application.DeleteCustomList Application.CustomListCount -- HTH Bob Phillips "fugfug" wrote in message ... Hi, I am trying to write a macro to do a custom sort. I have writen part of it which enters a custom list then it moves to the data I want to sort and it is supposed to sort it in the order of the custom list. My problem is I can't get the macro to choose my custom list which is at the bottom of the custom lists. Below is the code. Sheets("Customers").Select Range("A3").Select Selection.Sort Key1:=Range("A3"), Order1:=xlAscending, Header:=xlGuess, _ OrderCustom:=12, MatchCase:=False, Orientation:=xlTopToBottom Thanks. nb. Using Excel 97 James -- fugfug ------------------------------------------------------------------------ fugfug's Profile: http://www.excelforum.com/member.php...o&userid=24950 View this thread: http://www.excelforum.com/showthread...hreadid=386709 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Thanks Bob. I see the bit you have changed in the code OrderCustom:=Application.CustomListCount In my code I had this = to 12 which I assume means twelth on the list Does the customlistcount just count how many items in the custom lis or does it do something different? Thanks. Jame -- fugfu ----------------------------------------------------------------------- fugfug's Profile: http://www.excelforum.com/member.php...fo&userid=2495 View this thread: http://www.excelforum.com/showthread.php?threadid=38670 |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() I've just tried the new code, it does not quite work. It always choose the custom list one from the bottom of the list........ Jame -- fugfu ----------------------------------------------------------------------- fugfug's Profile: http://www.excelforum.com/member.php...fo&userid=2495 View this thread: http://www.excelforum.com/showthread.php?threadid=38670 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Advanced Sort Question | Excel Discussion (Misc queries) | |||
Code to replace Advanced Filter | Excel Discussion (Misc queries) | |||
Advanced Conditional Formatting Ideas Needed! (ok, maybe not that advanced...) | Excel Discussion (Misc queries) | |||
How can I advanced sort into a Collum | Excel Discussion (Misc queries) | |||
Advanced Sorting\VBA Code | Excel Programming |