+ Reply to Thread
Results 1 to 10 of 10

Alternative to concatenate

  1. #1
    Registered User
    Join Date
    06-06-2008
    Posts
    34

    Alternative to concatenate

    Hi,

    I'm looking to take a long list of e-mail addresses, probably 100 orso, that will be in Cell A2 downwards, one by one. In non-VB I would've used the concatenate formula to combine them all with a "; " in between, so I could then copy-paste in Outlook.

    I know this isn't available in VB, so I was wondering if there's an obvious way to do this? My current longwinded solution is:

    Please Login or Register  to view this content.
    Last edited by Toddneyx; 12-12-2010 at 06:20 AM.

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Alternative to concatenate

    Not sure what you mean by isn't available in VB, but how about:

    Please Login or Register  to view this content.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Alternative to concatenate

    Hello Toddneyx,

    This code will find the last cell in column "A", and then add a semi-colon to each cell in the range.
    Please Login or Register  to view this content.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  4. #4
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Alternative to concatenate

    Please Login or Register  to view this content.
    or

    Please Login or Register  to view this content.
    Last edited by snb; 12-06-2010 at 05:53 PM.



  5. #5
    Registered User
    Join Date
    06-06-2008
    Posts
    34

    Re: Alternative to concatenate

    Quote Originally Posted by snb View Post
    Please Login or Register  to view this content.
    or

    Please Login or Register  to view this content.
    And if my data was in a specific worksheet, would the following work?

    Please Login or Register  to view this content.
    I get the error Object variable or With block variable not set

  6. #6
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Alternative to concatenate

    Please Login or Register  to view this content.
    I hope you realise it's an unnecessary step, as I illustrated in my previous post.

  7. #7
    Registered User
    Join Date
    06-06-2008
    Posts
    34

    Re: Alternative to concatenate

    Sorry I must've missed your point in the previous post, which step is unnecessary?

  8. #8
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Alternative to concatenate

    The defining of a namedrange.

    This will do:

    Please Login or Register  to view this content.
    and if you want to make that more robust:

    Please Login or Register  to view this content.

  9. #9
    Registered User
    Join Date
    06-06-2008
    Posts
    34

    Re: Alternative to concatenate

    Ah ok, wasn't sure how to write the reference to another worksheet within that

  10. #10
    Registered User
    Join Date
    06-06-2008
    Posts
    34

    Re: Alternative to concatenate

    I've managed to get it working, partially - now it's just a matter of getting these two functions working under one button.

    Please Login or Register  to view this content.

    Is my sub PasteData() not "ending" correctly? Because if I assign these two subs to two different buttons, then it works 100%. But if I assign both subs to one button, or both functions under one sub - it fails.
    Last edited by Toddneyx; 12-08-2010 at 10:54 AM. Reason: Fixed If statement coding

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1