View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
JE McGimpsey JE McGimpsey is offline
external usenet poster
 
Posts: 4,624
Default Macro to move first name to last position in cell

one way:

Public Sub TransposeNames()
Dim rCell As Range
Dim sTemp As String
For Each rCell In Selection
sTemp = rCell.Text
If InStr(sTemp, ",") = 0 Then
sTemp = Application.Trim( _
Mid(sTemp, InStr(sTemp, " ")) & ", " & _
Left(sTemp, InStr(sTemp, " ") - 1))
rCell.Value = sTemp
End If
Next rCell
End Sub




In article ,
"Annette" wrote:

I need a macro that will transpose the first name with the last name in each
of the cells of numerous spreadsheets in column A ... some of the users had
put in the names first last while other formatted their as last, first ...

We want them to appear as last, first on all. Is there a method to do so?

Thanks!