You need to refine sfix or list all suffixes in range.
Sub test()
Dim a, i As Long, sfix As String
sfix = "sr.|jr.|phd|etc"
With Range("a1", Range("a" & Rows.Count).End(xlUp))
a = .Value
With CreateObject("VBScript.RegExp")
.Global = True: .IgnoreCase = True
.Pattern = "([$^()\\{}\[\]+*?.-])"
sfix = "(" & .Replace(sfix, "\$1") & ")"
For i = 1 To UBound(a, 1)
.Pattern = "^([^, -]+-)?([^, .-]+) " & sfix & ", (\S+).*"
If .test(a(i, 1)) Then
a(i, 1) = .Replace(a(i, 1), "$4 $2")
Else
.Pattern = "^(\S+).* (\S+) " & sfix & "$"
If .test(a(i, 1)) Then
a(i, 1) = .Replace(a(i, 1), "$1 $2")
Else
.Pattern = "^([^, -]+-)?([^, ]+), (\S+).*"
If .test(a(i, 1)) Then
a(i, 1) = .Replace(a(i, 1), "$3 $2")
Else
.Pattern = "^(\S+).* (\S+)$"
If .test(a(i, 1)) Then
a(i, 1) = .Replace(a(i, 1), "$1 $2")
End If
End If
End If
End If
Next
End With
.Columns("b") = a
End With
End Sub
Bookmarks