Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Convert name into email address?

I have a client who has an Excel spreadsheet with one column of names.
Each cell in that column is in the format:

LASTNAME, FIRSTNAME

He wants to take that column of entries and convert each to:



.... where XYZ.com is the same for each entry.

Is there an Excel macro that will do that? Or a VB script?

TIA

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Convert name into email address?

You can do it either with a formula or with VBA code. Insert a new column
next to your existing names and enter the following formula and fill down as
far as you need to go.

=TRIM(MID(A1,FIND(",",A1)+1,LEN(A1)))&"."&LEFT(A1, "

If you want a VBA approach, use the following macro:


Sub CreateAddresses()
Dim LastName As String
Dim FirstName As String
Dim Domain As String
Dim Pos As String
Dim R As Range

Domain = "xyz.com" '<<<< CHANGE

For Each R In Selection.Cells
Pos = InStr(1, R.Text, ",", vbBinaryCompare)
If Pos 0 Then
LastName = Left(R.Text, Pos - 1)
FirstName = Trim(Mid(R.Text, Pos + 1))
R(1, 2).Value = FirstName & "." & LastName & "@" & Domain
End If
Next R

End Sub

Select the cells to change and then run the code.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel, 10 Years
Pearson Software Consulting
www.cpearson.com
(email on the web site)


wrote in message
oups.com...
I have a client who has an Excel spreadsheet with one column of names.
Each cell in that column is in the format:

LASTNAME, FIRSTNAME

He wants to take that column of entries and convert each to:



... where XYZ.com is the same for each entry.

Is there an Excel macro that will do that? Or a VB script?

TIA


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Convert name into email address?

On Wednesday, October 24, 2007 1:43:34 PM UTC-4, Chip Pearson wrote:

This was super helpful for me. Thanks.
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
convert email address file in Excel 2000 to Word file with commas Mike A. Excel Discussion (Misc queries) 8 October 14th 08 02:48 PM
Function to convert to email address? [email protected] Excel Worksheet Functions 4 November 12th 07 08:39 PM
how can i convert an email address to a web address Arvind Sikar Excel Worksheet Functions 3 October 3rd 06 08:06 PM
can I copy a column of email addresses, paste into email address? Lizizfree New Users to Excel 4 July 20th 06 10:03 PM
Transfer Email addresses from spreadsheet to email address book Beana Excel Discussion (Misc queries) 2 May 30th 06 06:07 PM


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