Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 237
Default LastName, FirstName format

Hey guys,

In range A5:A100 I have names. The names are in format of
LastName, FirstName (example: Huttenstine, Todd). What is
a code I can run that will go through this range and for
every value that it finds a "," in it, it reverse the
order and take out the "," so it shows FirstName LastName.

Example:

Huttenstine, Todd turns into Todd Huttenstine.

Thanx
Todd
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default LastName, FirstName format

Sub Tester12()
Dim sStr As String
Dim cell As Range
For Each cell In Range("A5:A100")
If Not IsEmpty(cell) Then
If InStr(cell, ",") Then
sStr = Right(cell, Len(cell) _
- InStr(cell, ","))
cell.Value = Trim(sStr) & " " & _
Trim(Left(cell, _
InStr(cell, ",") - 1))
End If
Else
Exit For
End If
Next

End Sub

--
Regards,
Tom Ogilvy


Todd Huttenstine wrote in message
...
Hey guys,

In range A5:A100 I have names. The names are in format of
LastName, FirstName (example: Huttenstine, Todd). What is
a code I can run that will go through this range and for
every value that it finds a "," in it, it reverse the
order and take out the "," so it shows FirstName LastName.

Example:

Huttenstine, Todd turns into Todd Huttenstine.

Thanx
Todd



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 237
Default LastName, FirstName format

Thank you.


-----Original Message-----
Sub Tester12()
Dim sStr As String
Dim cell As Range
For Each cell In Range("A5:A100")
If Not IsEmpty(cell) Then
If InStr(cell, ",") Then
sStr = Right(cell, Len(cell) _
- InStr(cell, ","))
cell.Value = Trim(sStr) & " " & _
Trim(Left(cell, _
InStr(cell, ",") - 1))
End If
Else
Exit For
End If
Next

End Sub

--
Regards,
Tom Ogilvy


Todd Huttenstine

wrote in message
...
Hey guys,

In range A5:A100 I have names. The names are in format

of
LastName, FirstName (example: Huttenstine, Todd). What

is
a code I can run that will go through this range and for
every value that it finds a "," in it, it reverse the
order and take out the "," so it shows FirstName

LastName.

Example:

Huttenstine, Todd turns into Todd Huttenstine.

Thanx
Todd



.

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
separate lastname from firstname enrico via OfficeKB.com Excel Worksheet Functions 3 April 14th 09 06:56 AM
Is there a way to separate FirstName and LastName ? Mark246 Excel Discussion (Misc queries) 4 February 24th 08 01:42 AM
LastName, FirstName covert to FirstName LastName Craig860 Excel Discussion (Misc queries) 4 January 14th 08 09:58 PM
How to change lastname, firstname to firstname lastname in Excel? mert Excel Discussion (Misc queries) 1 January 9th 08 06:06 PM
FirstName, LastName and vice versa Bob Excel Worksheet Functions 3 October 27th 06 06:54 PM


All times are GMT +1. The time now is 12:44 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"