I am using the following code to sort in custom way
Code: Select all
Sub Test()
Dim n As Long
Application.AddCustomList Array(Empty, "xx", "yy", "rr", "bb", "nn", "tt", "ff")
n = Application.CustomListCount
With Sheets("Sheet1")
.Range("A1").CurrentRegion.Sort Key1:=.Range("AU1"), Header:=xlYes, OrderCustom:=n + 1
.Sort.SortFields.Clear
End With
Application.DeleteCustomList n
End Sub