Using col C as helper column, try this:
Sub b1269739b()
'https://www.excelforum.com/excel-programming-vba-macros/1269739-how-to-sort-or-move-list-of-preferred-names.html
Dim i As Long, m As Long, n As Long, z As Long
Dim tx1 As String, tx2 As String
tx1 = Range("J5"): tx2 = Range("J6")
n = Range("A" & Rows.count).End(xlUp).Row
m = (n - 1) \ 2
Range("C1") = 1: Range("C1:C" & n).DataSeries
For i = 2 To n
If Range("B" & i) = tx1 Or Range("B" & i) = tx2 Then Range("C" & i) = n + 1: z = z + 1
Next
Range("A" & 1 & ":C" & n).Sort Key1:=[c1], Order1:=xlAscending, Header:=xlYes
Range("A" & n - z + 1 & ":C" & n).Cut
Range("A" & m + 1).Insert xlDown
Columns("C").ClearContents
End Sub
Bookmarks