Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Automatically rearranging text in a cell
Thanks Jim - this worked beautifully! Saves me a bit of time. =)
"Jim Thomlinson" wrote: Here is a function that you can use... Add this code to a standard code module (the same place that a recorded macro would be) Public Function FormatName(ByVal InputName As String) As String FormatName = Right(InputName, Len(InputName) - _ InStrRev(Trim(InputName), " ")) & _ ", " & Trim(Left(InputName, InStrRev(InputName, " "))) End Function You can use this the same way you would use any excel function, so if your name is in Cell A1 in Cell B1 put =FormatName(A1) -- HTH... Jim Thomlinson "faerie_bel" wrote: I have a spreadsheet listing names of people. I copy/paste the full name of the person from another program into my spreadsheet, but my problem is that I then need to display it with the Surname first. eg: if the name is "Joe Smith", I want it to display as "Smith, Joe". Is there a Macro or something that can automate this process for me? I'm new to Macros and couldn't get one to work properly. Thanks in advance! |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Rearranging text data. | Excel Discussion (Misc queries) | |||
Rearranging text | Excel Discussion (Misc queries) | |||
Rearranging Data Within a Cell | Excel Worksheet Functions | |||
Rearranging order of digits in a cell | Excel Discussion (Misc queries) | |||
Rearranging data in a text cell | Excel Programming |