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

G'day there One & All,

Here I am back again, with another problem. This time while trying
to sort with a custom list.

Here's the code I'm trying to use:

Private Sub oBtnRank_Click()
If oBtnRank Then gRng.Sort _
key1:=Range("Rank"), _
order1:=srtDir, _
header:=xlYes, _
ordercustom:=cstmSrtRngCnt
gStr = "Rank"
End Sub

This is the code from one of the OptionButtons on my userform.
Except for the "ordercustom" part, the code is exactly the same as for 3
other optionbuttons, but they sort my range alphabetically (which is
what they're supposed to do).

This particular option is supposed to sort via my custom list, but
for some reason it insists on sorting alphabetically and ignoring my
custom list.

To explain a little; gRng has been "set" to a named dynamic range.
Range("Rank") is the heading for the third column in this range.
"srtDir" is a string which has been set to Ascending or Descending.
"cstmSrtRngCnt" is a numeric variable containing the count of custom
lists - it's determined by

If Not dSht.Range("wrkRanks").Cells.Count = 0 Then
Application.AddCustomList (dSht.Range("wrkRanks"))
End If
cstmSrtRngCnt = Application.CustomListCount

this is from the "Auto_Open" procedure.

My best friend Google has provided me with one or two examples, but not
a lot that seems applicable. There are heaps of descriptions of how to
use custom lists directly from the sheet, but I've not found a lot that
demonstrates how to do it in VB.

If anyone can shed some light on this for me I'd be very grateful.

Thanks very much for listening,
--
Ken McLennan
Qld, Australia
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Custom Sort Problems

Hi Ken,

See MSKB article # 134913:

XL: GetCustomListNum Returns Unexpected List Number

http://support.microsoft.com/default.aspx?kbid=134913


---
Regards,
Norman



"Ken McLennan" wrote in message
.. .
G'day there One & All,

Here I am back again, with another problem. This time while trying
to sort with a custom list.

Here's the code I'm trying to use:

Private Sub oBtnRank_Click()
If oBtnRank Then gRng.Sort _
key1:=Range("Rank"), _
order1:=srtDir, _
header:=xlYes, _
ordercustom:=cstmSrtRngCnt
gStr = "Rank"
End Sub

This is the code from one of the OptionButtons on my userform.
Except for the "ordercustom" part, the code is exactly the same as for 3
other optionbuttons, but they sort my range alphabetically (which is
what they're supposed to do).

This particular option is supposed to sort via my custom list, but
for some reason it insists on sorting alphabetically and ignoring my
custom list.

To explain a little; gRng has been "set" to a named dynamic range.
Range("Rank") is the heading for the third column in this range.
"srtDir" is a string which has been set to Ascending or Descending.
"cstmSrtRngCnt" is a numeric variable containing the count of custom
lists - it's determined by

If Not dSht.Range("wrkRanks").Cells.Count = 0 Then
Application.AddCustomList (dSht.Range("wrkRanks"))
End If
cstmSrtRngCnt = Application.CustomListCount

this is from the "Auto_Open" procedure.

My best friend Google has provided me with one or two examples, but not
a lot that seems applicable. There are heaps of descriptions of how to
use custom lists directly from the sheet, but I've not found a lot that
demonstrates how to do it in VB.

If anyone can shed some light on this for me I'd be very grateful.

Thanks very much for listening,
--
Ken McLennan
Qld, Australia



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 90
Default Custom Sort Problems

G'day there Norman,

See MSKB article # 134913:

XL: GetCustomListNum Returns Unexpected List Number

http://support.microsoft.com/default.aspx?kbid=134913


Thanks very much for your advice. I went to the site and checked
what it had to say. As it turned out, altering the index number was
something I'd already tried but had no success. I rechecked everything
I was doing and tried for about an hour and a half to apply the
information that M'soft stated.

After many, many swear words and multiple rechecking of the code,
it suddenly struck me that the method may not have been the problem, but
the data. I don't know what made me think of it, but on checking I found
that my custom sort had turned to crap because the data I was using
hadn't been validated. It was just a bunch of entries I'd typed in to
give myself some sample data.

Hence I was trying to sort data that wasn't recognised by my
custom list!! DOH!!!

Now that I've embarassed myself, and wasted hours & hours over
several days, I'll move on =).

Thanks once again for your assistance. Your suggestion was spot
on, as that WAS one of the issues. I needed to get that correct before I
was prompted to move on to check my data.

See ya
Ken McLennan
Qld, Australia
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
More help with Custom menu's 2 problems! Karoo News Excel Programming 2 August 20th 05 03:24 PM
Excel sort by Fill Color by custom list sort Dash4Cash Excel Discussion (Misc queries) 2 July 29th 05 10:45 PM
Custom cell format problems Adam Excel Discussion (Misc queries) 1 June 29th 05 05:50 AM
Custom menu problems Andrew Fletcher Excel Programming 5 April 3rd 05 01:42 PM
Custom function problems Andrew B[_2_] Excel Programming 0 June 17th 04 05:20 AM


All times are GMT +1. The time now is 07:50 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"