+ Reply to Thread
Results 1 to 8 of 8

Concatenate multiple row in single row-

Hybrid View

visha_1984 Concatenate multiple row in... 02-07-2013, 06:27 AM
arlu1201 Re: Concatenate multiple row... 02-07-2013, 06:34 AM
visha_1984 Re: Concatenate multiple row... 02-07-2013, 06:42 AM
jindon Re: Concatenate multiple row... 02-07-2013, 06:39 AM
visha_1984 Re: Concatenate multiple row... 02-07-2013, 06:45 AM
jindon Re: Concatenate multiple row... 02-07-2013, 06:47 AM
MaczaQ Re: Concatenate multiple row... 02-07-2013, 06:41 AM
visha_1984 Re: Concatenate multiple row... 02-07-2013, 06:48 AM
  1. #1
    Forum Contributor visha_1984's Avatar
    Join Date
    11-27-2012
    Location
    Pune,India
    MS-Off Ver
    Excel 2013
    Posts
    309

    Concatenate multiple row in single row-

    I need function or macro code which is Concatente multiple cells in single cell.
    i have attach sample workbook
    Attached Files Attached Files
    Happy to Help

    VISHA

    Click *, if the suggestion helps you!
    If your problem is solved, then please mark the thread as SOLVED>>Above your first post>>Thread Tools>> "Mark your thread as Solved"

  2. #2
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,167

    Re: Concatenate multiple row in single row-

    Try this code
    Option Explicit
    
    Sub concatenate_rows()
    Dim i As Long, lrow As Long
    
    Application.ScreenUpdating = False
    
    With Worksheets("Sheet1")
        .Rows(1).Insert
        lrow = .Range("A" & .Rows.Count).End(xlUp).Row
        For i = lrow To 2 Step -1
            If .Range("A" & i - 1).Value <> "" Then
                .Range("A" & i - 1).Value = .Range("A" & i - 1).Value & " " & .Range("A" & i).Value
                .Rows(i).ClearContents
            End If
        Next i
        .Rows(1).Delete
    End With
    
    MsgBox "Done"
    
    Application.ScreenUpdating = True
    
    End Sub
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  3. #3
    Forum Contributor visha_1984's Avatar
    Join Date
    11-27-2012
    Location
    Pune,India
    MS-Off Ver
    Excel 2013
    Posts
    309

    Re: Concatenate multiple row in single row-

    Thank u
    Arlu ance again...

    it works Good Day

  4. #4
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,834

    Re: Concatenate multiple row in single row-

    try
    Option Explicit
    
    Sub test()
        Dim myArea As Range
        With Range("a1", Range("a" & Rows.Count).End(xlUp))
            For Each myArea In .SpecialCells(2).Areas
                If myArea.Rows.Count > 1 Then
                    myArea.Cells(1, 2) = _
                    Join$(Application.Transpose(myArea.Value))
                Else
                    myArea.Cells(1, 2).Value = myArea.Value
                End If
            Next
        End With
    End Sub

  5. #5
    Forum Contributor visha_1984's Avatar
    Join Date
    11-27-2012
    Location
    Pune,India
    MS-Off Ver
    Excel 2013
    Posts
    309

    Re: Concatenate multiple row in single row-

    Hi,Jindon

    thank for quick reply great

  6. #6
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,834

    Re: Concatenate multiple row in single row-

    Quote Originally Posted by visha_1984 View Post
    Hi,Jindon

    thank for quick reply great
    You are welcome and I suggest not to use any code that is not declaring variable withiin a procedure, or you may get a big problem sometime.

  7. #7
    Valued Forum Contributor MaczaQ's Avatar
    Join Date
    06-03-2011
    Location
    Poland
    MS-Off Ver
    Excel 2003 / XP
    Posts
    510

    Re: Concatenate multiple row in single row-

    one more way:
    Sub ConcantateFromColumnA()
    'http://www.excelforum.com/excel-programming-vba-macros/898088-concatenate-multiple-row-in-single-row.html
    'Author: MaczaQ 07-Feb-2013
      
      For Each ar In Columns(1).SpecialCells(xlCellTypeConstants).Areas
       Debug.Print ar.Address
       If ar.Cells.Count = 1 Then
        ar.Cells(1, 1).Offset(, 1).Value = ar.Cells(1, 1).Value
       Else
        ar.Cells(1, 1).Offset(, 1).Value = Join(Application.Transpose(ar.Cells), " ")
       End If
      Next ar
    End Sub
    Best Regards
    MaczaQ
    ---------------------------------------------------------------------------------------------------------------------------
    If you are satisfied with the solution(s) provided, please mark your thread as Solved
    If you are pleased with my answer consider to rate it. To thank someone who has helped you, click on the star icon below their name.
    - This way you will add him some reputation points ... thanks in advance.

  8. #8
    Forum Contributor visha_1984's Avatar
    Join Date
    11-27-2012
    Location
    Pune,India
    MS-Off Ver
    Excel 2013
    Posts
    309

    Re: Concatenate multiple row in single row-

    Hi, MacazQ

    Thanku working good

+ 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