Custom sort with blanks

Alli

New Member
Joined
May 25, 2010
Messages
25
Hello
In a macro I add a custom sort list based on a list/range on (Page A), then I sort a list on Page A based on the custom list.
Finally it "worked" in that there were no more syntax errors, but it is sorting alphabetically, NOT in the order specified on the other page
????
1. So my first question is: what have I left out that it is reverting to alphabetic order? (I have checked, and the customlist is being created, and is in the order I want it)

2. Additionally, what I'd like to do, is sort it in the order on Page A, but leave a blank in the appropriate row on Page B if the list does not include something in the list on Page A.

-Hope that makes sense-
The relevant piece of code is below.


Code:
RelRange1 = relColS & relrow & ":" & relColS & 10
Application.AddCustomList Worksheets("2 All indicator names").Range(RelRange1)
iCustListNum = Application.CustomListCount
'
' sort using latest custom sort order entry
newrow = ActiveCell.Row
newCol = Chr(ActiveCell.Column + 64)
RelRange2 = newCol & newrow & ":" & newCol & (newrow + 9)
'
Range(RelRange2).Sort Key1:=Range(newCol & newrow), OrderCustom:=9, Header:=xlNo, MatchCase:=False
'
' remove latest custom sort entry order
Application.DeleteCustomList Application.CustomListCount
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.

Forum statistics

Threads
1,215,062
Messages
6,122,925
Members
449,094
Latest member
teemeren

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