View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Trent Argante Trent Argante is offline
external usenet poster
 
Posts: 39
Default Flipping a name

Sub Selection_Loop()
Dim rngSelection As Range
Set rngSelection = Selection
Dim varCell As Variant

Dim intSpacePosition As Integer
Dim strFirstName As String
Dim strLastName As String

For Each varCell In rngSelection.Cells

With varCell
intSpacePosition = InStr(.Value, " ")
strFirstName = Left(.Value, intSpacePosition - 1)
strLastName = Mid(.Value, intSpacePosition + 1)

.Value = strLastName & ", " & strFirstName
End With

Next
End Sub
HTH
--
Trent Argante
[DC.J(<#)]


"Duncan_J" wrote:

If I got column of names
John Doe

And what to change it to
Doe, John

Is thier a way of doing this?

DJ