Custom sort issue

ricorico

New Member
Joined
Jun 15, 2013
Messages
14
Here is my code :

Sub SortCol()

With Application
.AddCustomList listArray:=Array("P9:P16")
x = .CustomListCount
Range("A9:N16").Sort Key1:=Range("A9"), Order1:=xlAscending, Header:=xlNo, _
OrderCustom:=x, MatchCase:=False, Orientation:=xlTopToBottom
.DeleteCustomList ListNum:=x + 1
End With
End Sub

Cell range A9:N16 are the data to be sorted. P9:P16 is a custom list containing number (i.e. 1 ,2 ,3 ,5 ,7 ,9 ,8 ,6).
The code doesn't work , any idea?


from KH
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
Was the range providing custom list x sorted BEFORE being created ?
 
Upvote 0
How about
VBA Code:
.AddCustomList Range("P9:P16").Value
 
Upvote 0
Please define "not work"
Did you get an error if so what was the error number and message?
 
Upvote 0
Does P9 on the active sheet contain a value?
 
Upvote 0
In that case it maybe you can't do that on a Mac & as I don't use Mac's I cannot help any further.
 
Upvote 0

Forum statistics

Threads
1,223,897
Messages
6,175,270
Members
452,628
Latest member
dd2

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top