+ Reply to Thread
Results 1 to 3 of 3

Excel VBA - concatenate and carriage return

Hybrid View

  1. #1
    Registered User
    Join Date
    10-26-2012
    Location
    Leeds, England
    MS-Off Ver
    Excel 2003
    Posts
    2

    Excel VBA - concatenate and carriage return

    Good morning

    I am using the following code (found using google) to concatenate an entire column. I am wanting the information to be on the line below but in the same cell so that it looks like this for example:

    Adele Castlehouse
    James Trafford
    Andrew Short
    Jack Porter.

    I'm quite new to VBA and I'm not sure how to incorporate the carriage return to the following code (if at all possible)

    Function CONCT(varRange As Range, strDel As String) As String
    CONCT = Join(WorksheetFunction.Transpose(varRange), strDel)
    End Function
    Thanks
    Adele
    Last edited by arlu1201; 10-26-2012 at 06:35 AM. Reason: Use code tags in future.

  2. #2
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: Excel VBA - concatenate and carriage return

    Function CONCT(varRange As Range) As String
    CONCT = Join(WorksheetFunction.Transpose(varRange), vbCrLf)
    End Function
    If solved remember to mark Thread as solved

  3. #3
    Registered User
    Join Date
    10-26-2012
    Location
    Leeds, England
    MS-Off Ver
    Excel 2003
    Posts
    2

    Re: Excel VBA - concatenate and carriage return

    Thank you for your reply, however, there are some cells in the columns that are blank. This code shows the squares on each blank line.

+ 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