+ Reply to Thread
Results 1 to 3 of 3

Combine rows

Hybrid View

  1. #1
    Registered User
    Join Date
    08-12-2009
    Location
    Sweden
    MS-Off Ver
    Microsoft 365 MSO (Version 2301 Build 16.0.16015.20000) 64-bit
    Posts
    10

    Combine rows

    Hello,

    I've got a problem with excel. I want to join rows automaticaly just like in this example:

    From this:

    Col 1 Col 2 Col 3 Col 4 ...
    Row 1: bla bla bla bla
    Row 2: ooo ooo ooo ooo
    Row 3: 333 333 333 333
    ...
    ...
    ...

    To this:

    Col 1 Col 2 Col 3 Col 4 Col 5 Col 6 Col 7 Col 8 Col 9 Col 10 ...
    Row0: bla bla bla bla ooo ooo ooo ooo 333 333 ...



    How can I do this with a macro? I'm very thankful for any help I can get. Thanks!

  2. #2
    Valued Forum Contributor
    Join Date
    06-17-2009
    Location
    Chennai,India
    MS-Off Ver
    Excel 2003,excel 2007
    Posts
    678

    Re: Combine rows

    try this macro. the result will be in sheet2

    Sub test()
    Dim j As Integer, k As Integer
    Worksheets("sheet2").Cells.Clear
    With Worksheets("sheet1")
    j = .Range("a1").End(xlDown).Row
    For k = 1 To j
    Range(.Cells(k, 1), .Cells(k, 1).End(xlToRight)).Copy
    Worksheets("sheet2").Cells(1, Columns.Count).End(xlToLeft).Offset(0, 1).PasteSpecial
    Next k
    End With
    
    Application.CutCopyMode = False
    
    
    End Sub

  3. #3
    Registered User
    Join Date
    08-12-2009
    Location
    Sweden
    MS-Off Ver
    Microsoft 365 MSO (Version 2301 Build 16.0.16015.20000) 64-bit
    Posts
    10

    Re: Combine rows

    Hey!

    Thanks it kinda worked! What if i want to have the data in a column instead of one row in sheet 2? How can I do this automaticaly with just one push of a button? Man I really need to learn visual basic to simplify use of excel, it would save alot of time.

    Thankful for all replies

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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