Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming,microsoft.public.office.developer.vba
external usenet poster
 
Posts: 10
Default Sort - OrderCustom

Hi programmers,

In Excel 2K
Selection.Sort ... OrderCustom:=xx
seems to work only using the number of a custom list. But how to be sure of
this number on any other computer then your own?
I tried to refere a range on a sheet, to create and use a (matrix) variable,
.... No go.
The only way seems to be to add the custom list, find the number and use it.

A kiss for a smart solution ;-).

Frans


  #2   Report Post  
Posted to microsoft.public.excel.programming,microsoft.public.office.developer.vba
external usenet poster
 
Posts: 11,272
Default Sort - OrderCustom

Basically, you have it right, you need to add it, then sort on the new
number

OrderCustom:=Application.CustomListCount

But guess what, there is a problem. See this article

http://support.microsoft.com/default.aspx?kbid=134913
XL: GetCustomListNum Returns Unexpected List Number

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Frans van Zelm" wrote in message
...
Hi programmers,

In Excel 2K
Selection.Sort ... OrderCustom:=xx
seems to work only using the number of a custom list. But how to be sure

of
this number on any other computer then your own?
I tried to refere a range on a sheet, to create and use a (matrix)

variable,
... No go.
The only way seems to be to add the custom list, find the number and use

it.

A kiss for a smart solution ;-).

Frans




  #3   Report Post  
Posted to microsoft.public.excel.programming,microsoft.public.office.developer.vba
external usenet poster
 
Posts: 5,302
Default Sort - OrderCustom

Hi Frans,

Adding your list is subject to a problem if the lists aleady exists.

According to VBA help:

"If the list you're trying to add already exists, this method does nothing".

However, my experience is that attempting to add a list that aleady exists,
causes a 1004 run-time error.

In either event, attempting to add a list will fail if the list already
exists.

A workaround, that works for me, is to include a spurious entry as the
first item of the list. This way the new list will always be accepted and
the list's postion will always be after any existing lists, i.e the new list
will always be in position: Application.CustomListCount.

Unlike the GetCustomListNum method, I am not aware of any problem with use
of the CustomListCount property.

If the spurious item is chosen such that it will not be found in any data to
be sorted, it should have no adverse impact.


---
Regards,
Norman


"Frans van Zelm" wrote in message
...
Hi programmers,

In Excel 2K
Selection.Sort ... OrderCustom:=xx
seems to work only using the number of a custom list. But how to be sure
of
this number on any other computer then your own?
I tried to refere a range on a sheet, to create and use a (matrix)
variable,
... No go.
The only way seems to be to add the custom list, find the number and use
it.

A kiss for a smart solution ;-).

Frans




  #4   Report Post  
Posted to microsoft.public.excel.programming,microsoft.public.office.developer.vba
external usenet poster
 
Posts: 5,302
Default Sort - OrderCustom

Hi Franz,

Retesting under xl2000, I was able to reproduce the problem mentioned in
Bob's MSKB link with a sort expression like:

OrderCustom:=Application.CustomListCount

Using the KB suggestion, and replacing the sort expression with:

OrderCustom:=Application.CustomListCount +1

resolved matters however.

---
Regards,
Norman



"Norman Jones" wrote in message
...
Hi Frans,

Adding your list is subject to a problem if the lists aleady exists.

According to VBA help:

"If the list you're trying to add already exists, this method does
nothing".

However, my experience is that attempting to add a list that aleady
exists, causes a 1004 run-time error.

In either event, attempting to add a list will fail if the list already
exists.

A workaround, that works for me, is to include a spurious entry as the
first item of the list. This way the new list will always be accepted and
the list's postion will always be after any existing lists, i.e the new
list will always be in position: Application.CustomListCount.

Unlike the GetCustomListNum method, I am not aware of any problem with use
of the CustomListCount property.

If the spurious item is chosen such that it will not be found in any data
to be sorted, it should have no adverse impact.


---
Regards,
Norman


"Frans van Zelm" wrote in message
...
Hi programmers,

In Excel 2K
Selection.Sort ... OrderCustom:=xx
seems to work only using the number of a custom list. But how to be sure
of
this number on any other computer then your own?
I tried to refere a range on a sheet, to create and use a (matrix)
variable,
... No go.
The only way seems to be to add the custom list, find the number and use
it.

A kiss for a smart solution ;-).

Frans






  #5   Report Post  
Posted to microsoft.public.excel.programming,microsoft.public.office.developer.vba
external usenet poster
 
Posts: 11,272
Default Sort - OrderCustom

Hi Norman,

the problem with this is that it is not consistent, so do you add or not?

Bob


"Norman Jones" wrote in message
...
Hi Franz,

Retesting under xl2000, I was able to reproduce the problem mentioned in
Bob's MSKB link with a sort expression like:

OrderCustom:=Application.CustomListCount

Using the KB suggestion, and replacing the sort expression with:

OrderCustom:=Application.CustomListCount +1

resolved matters however.

---
Regards,
Norman



"Norman Jones" wrote in message
...
Hi Frans,

Adding your list is subject to a problem if the lists aleady exists.

According to VBA help:

"If the list you're trying to add already exists, this method does
nothing".

However, my experience is that attempting to add a list that aleady
exists, causes a 1004 run-time error.

In either event, attempting to add a list will fail if the list already
exists.

A workaround, that works for me, is to include a spurious entry as the
first item of the list. This way the new list will always be accepted

and
the list's postion will always be after any existing lists, i.e the new
list will always be in position: Application.CustomListCount.

Unlike the GetCustomListNum method, I am not aware of any problem with

use
of the CustomListCount property.

If the spurious item is chosen such that it will not be found in any

data
to be sorted, it should have no adverse impact.


---
Regards,
Norman


"Frans van Zelm" wrote in message
...
Hi programmers,

In Excel 2K
Selection.Sort ... OrderCustom:=xx
seems to work only using the number of a custom list. But how to be

sure
of
this number on any other computer then your own?
I tried to refere a range on a sheet, to create and use a (matrix)
variable,
... No go.
The only way seems to be to add the custom list, find the number and

use
it.

A kiss for a smart solution ;-).

Frans










  #6   Report Post  
Posted to microsoft.public.excel.programming,microsoft.public.office.developer.vba
external usenet poster
 
Posts: 5,302
Default Sort - OrderCustom

Hi Bob,

Using Application.CustomListCount +1 in the Sort statement, seemed to work
consistently for me - but I cannot vouch for this as a universal solution.


---
Regards,
Norman



"Bob Phillips" wrote in message
...
Hi Norman,

the problem with this is that it is not consistent, so do you add or not?

Bob




  #7   Report Post  
Posted to microsoft.public.excel.programming,microsoft.public.office.developer.vba
external usenet poster
 
Posts: 11,272
Default Sort - OrderCustom

I first used CustomListCount in a solution I provided, and I did not have to
add 1. So I was surprised when in another response I gave, the OP responded
with a problem which we traced to this inconsistency. So, I have never seen
it, you seem to always see it, and I hate inconsistency :-).

Regards

Bob


"Norman Jones" wrote in message
...
Hi Bob,

Using Application.CustomListCount +1 in the Sort statement, seemed to work
consistently for me - but I cannot vouch for this as a universal solution.


---
Regards,
Norman



"Bob Phillips" wrote in message
...
Hi Norman,

the problem with this is that it is not consistent, so do you add or

not?

Bob






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
Updating workbook with an alpha sort sheet and a numeric sort shee cjlatta Excel Discussion (Misc queries) 2 January 28th 09 12:00 AM
sort function for dates does not sort properly in Office 2007 Exc. Rosalie Excel Worksheet Functions 1 November 22nd 07 10:25 PM
Excel sort by Fill Color by custom list sort Dash4Cash Excel Discussion (Misc queries) 2 July 29th 05 10:45 PM
sort (on part of) string - originally posted under Tricky Sort Tom Ogilvy Excel Programming 0 August 6th 04 02:42 AM
sheet.range.sort with ordercustom Cam[_3_] Excel Programming 0 August 25th 03 01:54 AM


All times are GMT +1. The time now is 12:21 AM.

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"