Originally Posted by
mvidas
Hi BD,
Why not add a custom sort list?[vba] Dim AnArray() As String, i As Long, SortNum As Long
ReDim AnArray(400)
For i = 0 To 400
AnArray(i) = "N" & CStr(i)
Next
Application.AddCustomList ListArray:=AnArray
SortNum = Application.GetCustomListNum(AnArray)
Application.Goto Reference:="Curric_NameSort"
Selection.Sort Key1:=Range("B4"), Order1:=xlAscending, Header:=xlYes, _
OrderCustom:=SortNum + 1, MatchCase:=False, Orientation:=xlTopToBottom[/vba]If the list exists already, a new one won't be added, otherwise it is. The listnumber is zero-based using GetCustomListNum, but the .Sort method uses a one-based list for whatever reason, so I have to add 1 to SortNum.
Also, if I knew what range Curric_NameSort referred to, I'd recommend removing the application.goto part and just using:[vba] With Range("Curric_NameSort")
.Sort Key1:=.Columns(2), Order1:=xlAscending, Header:=xlYes, _
OrderCustom:=SortNum + 1, MatchCase:=False, Orientation:=xlTopToBottom
End With[/vba]Matt