Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 32
Default need a macro to edit names in excel

I'd like to create (or use someone else's) a macro to edit names in Excel
spreadsheets. I need a.) to remove the last name and comma from a
last-name-first listing, and b.) to remove the comma and first name from a
last-name-first listing. In a.) that would leave the cell with only the first
name remaining, and in b.) would leave only the last name remaining.

Anyone have any suggestions or available macro's?
thanks!
Betsy
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,420
Default need a macro to edit names in excel

Use Data Text To Columns with comma as the delimiter.

--
__________________________________
HTH

Bob

"Betsy" wrote in message
...
I'd like to create (or use someone else's) a macro to edit names in Excel
spreadsheets. I need a.) to remove the last name and comma from a
last-name-first listing, and b.) to remove the comma and first name from a
last-name-first listing. In a.) that would leave the cell with only the
first
name remaining, and in b.) would leave only the last name remaining.

Anyone have any suggestions or available macro's?
thanks!
Betsy



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 32
Default need a macro to edit names in excel

Perfect. You just saved me countless hours!
Thanks so much !

"Bob Phillips" wrote:

Use Data Text To Columns with comma as the delimiter.

--
__________________________________
HTH

Bob

"Betsy" wrote in message
...
I'd like to create (or use someone else's) a macro to edit names in Excel
spreadsheets. I need a.) to remove the last name and comma from a
last-name-first listing, and b.) to remove the comma and first name from a
last-name-first listing. In a.) that would leave the cell with only the
first
name remaining, and in b.) would leave only the last name remaining.

Anyone have any suggestions or available macro's?
thanks!
Betsy




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 192
Default need a macro to edit names in excel

Below are the two macros I have used to do this and not have any spaces that
the text to columns leaves (unless there's a way to do the text to column
that can take out the space that I don't know about). You'll have to change
the start range, but should do the trick. Hope this helps!

Option Explicit
Sub RemoveLastName()

Dim r As String
Dim listname As Range

Set listname = Range("A14")
Do Until listname = ""
Do
If Left(listname, 1) < " " Then
listname = Right(listname, Len(listname) - 1)
Else:
listname = Right(listname, Len(listname) - 1)
Exit Do
End If
Loop
Set listname = listname.Offset(1, 0)
Loop

End Sub

Sub RemoveFirstName()

Dim r As String
Dim listname As Range

Set listname = Range("C14")
Do Until listname = ""
Do
If Right(listname, 1) < "," Then
listname = Left(listname, Len(listname) - 1)
Else:
listname = Left(listname, Len(listname) - 1)
Exit Do
End If
Loop
Set listname = listname.Offset(1, 0)
Loop

End Sub
--
-SA


"Betsy" wrote:

I'd like to create (or use someone else's) a macro to edit names in Excel
spreadsheets. I need a.) to remove the last name and comma from a
last-name-first listing, and b.) to remove the comma and first name from a
last-name-first listing. In a.) that would leave the cell with only the first
name remaining, and in b.) would leave only the last name remaining.

Anyone have any suggestions or available macro's?
thanks!
Betsy

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
dynamic range names in Edit - Go to Tim Marsh Excel Programming 2 June 23rd 06 01:47 PM
Lost edit on top line where menu names are RMK Excel Discussion (Misc queries) 1 January 26th 06 03:17 AM
Edit Color Palette Names SueDot Excel Discussion (Misc queries) 2 September 6th 05 03:51 PM
Edit a column of names Martin ©¿©¬ @mandeREMOVETHIS.plus.com Excel Discussion (Misc queries) 5 February 4th 05 01:39 PM
edit cell names all at once? pzaz Excel Programming 0 June 4th 04 07:30 PM


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