Combining text from several fields into one

alivibe

New Member
Joined
Mar 7, 2004
Messages
3
Hi. I have a list of email addresses in Excel 7.0a that I need to format in order to use them in my email program. The addresses appear in a column like so:

mike@yahoo.com
ted@sbcglobal.net
aaron@comcast.net

I need to combine these emai addresses so they have semi-colons and one space separating them, so that they read:

mike@yahoo.com; ted@sbcglobal.net; aaron@comcast.net

Then I'll cut and paste them into my email message.

What is the best way to do this? Thank you so much for your help!

~Ali
 
Smitty makes a good point about the cell limit, and has the right idea of using VBA from Ron de Bruin’s site to email a message to each person in a range (Outlook only):
http://www.rondebruin.nl/sendmail.htm#message

If you prefer to concatenate the email addresses in a worksheet cell, you could use the following function from Harlan Grove.

To call the function:
=aconcat(A1:A500, “; ”)
Adjust the range(s) to suit.

Put the function in a standard module.
Code:
Function aconcat(a As Variant, Optional sep As String = "") As String
' Harlan Grove, Mar 2002
    Dim y As Variant

    If TypeOf a Is Range Then
        For Each y In a.Cells
            aconcat = aconcat & y.Value & sep
        Next y
    ElseIf IsArray(a) Then
        For Each y In a
            aconcat = aconcat & y & sep
        Next y
    Else
        aconcat = aconcat & a & sep
    End If

    aconcat = Left(aconcat, Len(aconcat) - Len(sep))
End Function
Regards,

Mike
 
Upvote 0

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
Awesome tip that was very helpful.

However, I have a honken spreadsheet whereby I have to apply the formula given by Pennysaver in comlumns AA, AB, AC. When I apply the formula, I get the #NAME? error message because it recongizes, for example, AA as text in a forumla. Earlier in the spreadsheet, with single character columns, the formula worked flawlessly.

Is there a way around this??

Thanks in advance.
 
Upvote 0

Forum statistics

Threads
1,214,911
Messages
6,122,198
Members
449,072
Latest member
DW Draft

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top