I manage to sort data by two columns one of them is custom like that
Code: Select all
Dim n As Long
Application.AddCustomList Array("oo", "ww", "yy", "ss", "nn", "hh")
n = Application.CustomListCount
With ActiveSheet
.Range("A1").CurrentRegion.Sort Key1:=.Range("J1"), Key2:=.Range("D1"), Order2:=xlAscending, Header:=xlYes, OrderCustom:=n + 1
.Sort.SortFields.Clear
End With
Application.DeleteCustomList n
so the sort would be first by column J (this is the custom column related to the custom array) then by column K (descending) then by column D (ascending)