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: 5,651
Default Change order of data in a cell


On Tue, 6 Jan 2009 13:06:06 -0800, David
wrote:

Is it possible to write a macro that will change cells that have "Last Name,
First Name, Middle Initial" to "First Name, Middle Initial, Last Name" ?
Thank you for your help.
David


Yes it is.

Are you certain the data format is exactly as you have provided?
i.e. All cells have exactly three segments separated by commas.

Are you certain you want to have commas separating the segments in the result?

At its simplest, you could use something like:

==============
Option Explicit
Sub FixName()
Dim c As Range
Dim s
For Each c In Selection
s = Split(c.Text, ",")
c.Value = s(1) & ", " & s(2) & ", " & s(0)
Next c
End Sub
==================

Of course, since your original and result formats are identical, you'd have to
set up a routine to ensure that you didn't run the macro twice on the same
cell.
--ron
 
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
How to change the series order in a LEGEND ONLY...not data Steve P[_2_] Charts and Charting in Excel 2 December 3rd 08 08:44 AM
Change order of data in a cell Mary-Anne Excel Discussion (Misc queries) 3 October 30th 08 09:51 AM
How do I change the order of the data in a pie chart - excel 2003 carincamille Charts and Charting in Excel 1 February 12th 07 07:35 PM
Pivot Chart won't save order change of data MargaretBeckbury Excel Discussion (Misc queries) 1 January 18th 06 04:54 PM
How do I change the order of the series in the Source Data? Earl Charts and Charting in Excel 2 February 2nd 05 03:09 PM


All times are GMT +1. The time now is 09:11 AM.

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

About Us

"It's about Microsoft Excel"