Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35
Default 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   Report Post  
Posted to microsoft.public.excel.programming
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!

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Active cell position for macro MechEng Excel Worksheet Functions 3 September 24th 07 01:44 PM
Short cut to move back to last position seane Excel Discussion (Misc queries) 2 February 1st 06 08:18 AM
Why does cursor move position in a cell I'm trying to edit? BrendaK Excel Discussion (Misc queries) 3 August 22nd 05 10:32 PM
Relative Cell position NOT working with or without macro Scratching my Head Excel Discussion (Misc queries) 6 May 30th 05 06:12 PM
Move Cell to Top/Left Position on Screen Phil Hageman[_3_] Excel Programming 4 January 10th 04 07:24 PM


All times are GMT +1. The time now is 08:29 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"