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

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.

Forum statistics

Threads
1,223,228
Messages
6,170,871
Members
452,363
Latest member
merico17

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