Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro to move first name to last position in cell
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! |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
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! |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro to move first name to last position in cell
Thanks!
"JE McGimpsey" wrote in message ... 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! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Active cell position for macro | Excel Worksheet Functions | |||
Short cut to move back to last position | Excel Discussion (Misc queries) | |||
Why does cursor move position in a cell I'm trying to edit? | Excel Discussion (Misc queries) | |||
Relative Cell position NOT working with or without macro | Excel Discussion (Misc queries) | |||
Move Cell to Top/Left Position on Screen | Excel Programming |