Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
separate lastname from firstname | Excel Worksheet Functions | |||
Is there a way to separate FirstName and LastName ? | Excel Discussion (Misc queries) | |||
LastName, FirstName covert to FirstName LastName | Excel Discussion (Misc queries) | |||
How to change lastname, firstname to firstname lastname in Excel? | Excel Discussion (Misc queries) | |||
FirstName, LastName and vice versa | Excel Worksheet Functions |