LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default 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
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
Rearranging text data. Houston123 Excel Discussion (Misc queries) 4 June 21st 09 02:18 PM
Rearranging text falcios Excel Discussion (Misc queries) 13 February 11th 07 11:22 PM
Rearranging Data Within a Cell LDL Excel Worksheet Functions 5 October 24th 06 03:37 PM
Rearranging order of digits in a cell sk81222 Excel Discussion (Misc queries) 10 June 28th 06 09:01 PM
Rearranging data in a text cell giddne Excel Programming 6 September 3rd 05 09:30 PM


All times are GMT +1. The time now is 06:25 AM.

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"