Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 46
Default Flipping a name

If I got column of names
John Doe

And what to change it to
Doe, John

Is thier a way of doing this?

DJ
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Flipping a name

Try something like


Dim S As String
Dim Pos As Integer
S = Range("A1").Text
Pos = InStr(1, S, " ")
S = Mid(S, Pos + 1) & ", " & Left(S, Pos - 1)
Range("A1").Value = S


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com




"Duncan_J" wrote in message
...
If I got column of names
John Doe

And what to change it to
Doe, John

Is thier a way of doing this?

DJ



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 46
Default Flipping a name

Thanks Jim but couldn't get the function to work...
Thanks Trent. it works for the first one but it won't go to the next one and
the whole coulmn

"Duncan_J" wrote:

If I got column of names
John Doe

And what to change it to
Doe, John

Is thier a way of doing this?

DJ

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 46
Default Flipping a name

Thanks Guys I got'em to work... Thanks for the help

"Duncan_J" wrote:

If I got column of names
John Doe

And what to change it to
Doe, John

Is thier a way of doing this?

DJ

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 39
Default Flipping a name

Duncan, I forgot to add that it is selection dependent (i.e., the user must
manually select the range before executing the procedure).
Otherwise, you (the developer) has to give the procedure a way to terminate.
E.g.,
ActiveCell.SpecialCells(xlLastCell).Row
returns the last row's index of the ActiveSheet.
Thus:
Dim lngCurrentRow as Long
Range("<RangeID").Select 'E.g. Range("A1").Select
Do
lngCurrentRow = lngCurrentRow + 1
ActiveCell.Value = FormatName(ActiveCell.Value) 'This is from Jim
Thomlinson's solution
ActiveCell.Offset(1,0).Select 'This increments the cursor
Loop until lngCurrentRow = ActiveCell.SpecialCells(xlLastCell).Row

--
Trent Argante


"Duncan_J" wrote:

Thanks Jim but couldn't get the function to work...
Thanks Trent. it works for the first one but it won't go to the next one and
the whole coulmn

"Duncan_J" wrote:

If I got column of names
John Doe

And what to change it to
Doe, John

Is thier a way of doing this?

DJ

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
Flipping text Charlene Excel Worksheet Functions 4 November 15th 07 04:49 PM
Flipping a Spreadsheet Joy Excel Worksheet Functions 1 July 18th 07 02:16 PM
flipping a spreadsheet remarque Excel Worksheet Functions 2 October 27th 06 01:55 PM
Flipping a name Trent Argante Excel Programming 0 May 18th 05 05:44 PM
Flipping a name Jim Thomlinson[_3_] Excel Programming 0 May 18th 05 05:43 PM


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