+ Reply to Thread
Results 1 to 4 of 4

How do I merge the contents (separated by a comma) of 300+ cells?

  1. #1
    elliott
    Guest

    How do I merge the contents (separated by a comma) of 300+ cells?



  2. #2
    Bill Martin -- (Remove NOSPAM from address)
    Guest

    Re: How do I merge the contents (separated by a comma) of 300+ cells?

    elliott wrote:

    Why do people post notes with no content? Does it take an extra 100mS
    to actually type your question with some example of the data rather than
    trying to put it all in the subject line which frequently gets truncated
    anyhow?

    Bill

  3. #3
    Gord Dibben
    Guest

    Re: How do I merge the contents (separated by a comma) of 300+ cells?

    Bill

    Because they are using the not-so-efficient CDO and that seems to be the norm
    around there.

    Gord

    On Tue, 10 May 2005 13:43:11 -0400, "Bill Martin -- (Remove NOSPAM from
    address)" <[email protected]> wrote:

    >elliott wrote:
    >
    >Why do people post notes with no content? Does it take an extra 100mS
    >to actually type your question with some example of the data rather than
    >trying to put it all in the subject line which frequently gets truncated
    >anyhow?
    >
    >Bill



  4. #4
    Gord Dibben
    Guest

    Re: How do I merge the contents (separated by a comma) of 300+ cells?

    Elliot

    Are the cells contiguous or random?

    If contiguous, easily done with a user defined function.

    Function ConCatRange(CellBlock As Range) As String
    Dim Cell As Range
    Dim sbuf As String
    For Each Cell In CellBlock
    If Len(Cell.text) > 0 Then sbuf = sbuf & Cell.text & ","
    Next
    ConCatRange = Left(sbuf, Len(sbuf) - 1)
    End Function

    =ConCatRange(A1:J30) entered in K1

    Or a macro....

    Sub ConCat_Cells()
    Dim x As Range
    Dim y As Range
    Dim z As Range
    Dim w As String
    Dim sbuf As String
    On Error GoTo endit
    w = InputBox("Enter the Type of De-limiter Desired")
    Set z = Application.InputBox("Select Destination Cell", _
    "Destination Cell", , , , , , 8)
    Application.SendKeys "+{F8}"
    Set x = Application.InputBox _
    ("Select Cells...Contiguous or Non-Contiguous", _
    "Cells Selection", , , , , , 8)
    For Each y In x
    If Len(y.text) > 0 Then sbuf = sbuf & y.text & w
    Next
    z = Left(sbuf, Len(sbuf) - 1)
    Exit Sub
    endit:
    MsgBox "Nothing Selected. Please try again."
    End Sub


    Gord Dibben Excel MVP

    On Tue, 10 May 2005 10:16:03 -0700, "elliott"
    <[email protected]> wrote:



+ 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