this code will break up the name and put in columns. (in Excel)
it starts in H, and puts in I & J
adjust this code so it will post the Last ,and First into the correct column:
ActiveCell.Offset(0, 1).Formula = vFirst
ActiveCell.Offset(0, 2).Formula = vLast
Code:
Public Sub SplitName()
Dim i As Integer, c As Integer
Dim vWord, vLast, vFirst, vMI, vRem
c = 2
Range("H2").Select
While ActiveCell.Value <> ""
'If Len(ActiveCell.Value) > 2 And LCase(ActiveCell.Value) <> "patron" Then
vMI = ""
vWord = Trim(ActiveCell.Text)
i = InStrRev(vWord, " ")
vLast = Trim(Mid(vWord, i + 1))
vRem = vLast
i = InStr(vWord, " ")
vFirst = Left(vWord, i - 1)
' If InStr(vRem, " ") > 0 Then
' i = InStr(vRem, " ")
' vMI = Left(vRem, i - 1)
' vLast = Trim(Mid(vRem, i + 1))
' End If
ActiveCell.Offset(0, 1).Formula = vFirst
ActiveCell.Offset(0, 2).Formula = vLast
'ActiveCell.Offset(0, 9).Formula = vMI
'End If
'c = c + 1
ActiveCell.Offset(1, 0).Select 'next rows
Wend
End Sub