+ Reply to Thread
Results 1 to 11 of 11

Move 10 Columns of data to a single column

  1. #1
    Registered User
    Join Date
    03-06-2024
    Location
    Sydney, Australia
    MS-Off Ver
    Windows 11/ Most Recent
    Posts
    4

    Move 10 Columns of data to a single column

    Hello,

    So there are two parts to this post as I would like to learn along the way.

    1. I have the input and it is 10 columns of data but I would like a macro that copies all data to column A.
    Column A stays in A, Col B moves to the bottom of Col A data, Col C moves to the bottom of Col A data.
    I have included 'Output' worksheet as an example of the output.
    I would also like this macro to work on a variable amount of columns. So it will work if there are 4 columns or 11 columns.

    2. Now, I would like to take the Output and add a prefix and a suffix to the single column of data created in part 1.

    3. If anyone really wants to show off they can copy the final single column to txt then save the txt with the extension '.dxf'.

    Not sure how to end these forums since it is my first so thank you in advance.
    Attached Files Attached Files
    Last edited by KeirStan; 03-07-2024 at 12:43 AM.

  2. #2
    Forum Expert
    Join Date
    10-19-2021
    Location
    Brazil
    MS-Off Ver
    Office 365 V2401 w/ Win10 Home 64 Bit
    Posts
    2,014

    Re: Move 10 Columns of data to a single column

    You could achieve this result with formula too.

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Attached Files Attached Files

  3. #3
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,466

    Re: Move 10 Columns of data to a single column

    try below code
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Quang PT

  4. #4
    Registered User
    Join Date
    03-06-2024
    Location
    Sydney, Australia
    MS-Off Ver
    Windows 11/ Most Recent
    Posts
    4

    Re: Move 10 Columns of data to a single column

    Hello, yes this works however I deleted two columns of data and it did not work anymore. Is there a way we can make it work for a variable amount of columns so I can add/delete columns please?

  5. #5
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,466

    Re: Move 10 Columns of data to a single column

    Replace
    PHP Code: 
    With Sheets("Input")
        
    lr = .Range("A1").CurrentRegion.Rows.Count
        rng 
    = .Range("A1:J" lr).Value ' If data from column A to J (10 columns)
    End With 
    with
    PHP Code: 
    With Sheets("Input")
        
    rng = .Range("A1").CurrentRegion.Value
    End With 

  6. #6
    Registered User
    Join Date
    03-06-2024
    Location
    Sydney, Australia
    MS-Off Ver
    Windows 11/ Most Recent
    Posts
    4

    Re: Move 10 Columns of data to a single column

    Amazing, that is it solved!! Well done!

  7. #7
    Registered User
    Join Date
    03-06-2024
    Location
    Sydney, Australia
    MS-Off Ver
    Windows 11/ Most Recent
    Posts
    4

    Re: Move 10 Columns of data to a single column

    Thanks, I was looking for a macro but I have learned something here. Thanks

  8. #8
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,528

    Re: Move 10 Columns of data to a single column

    Another possibility. Change references where required.
    Please Login or Register  to view this content.
    Experience trumps academics every day of the week and twice on Sunday.

  9. #9
    Forum Expert
    Join Date
    10-19-2021
    Location
    Brazil
    MS-Off Ver
    Office 365 V2401 w/ Win10 Home 64 Bit
    Posts
    2,014

    Re: Move 10 Columns of data to a single column

    Tks for the feedback, always good to learn something new.

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

    Re: Move 10 Columns of data to a single column

    Simply
    Please Login or Register  to view this content.
    Last edited by jindon; 03-07-2024 at 09:20 AM. Reason: Didn't look at the "Desired Result" sheet.

  11. #11
    Forum Expert
    Join Date
    10-19-2021
    Location
    Brazil
    MS-Off Ver
    Office 365 V2401 w/ Win10 Home 64 Bit
    Posts
    2,014

    Re: Move 10 Columns of data to a single column

    As a macro..
    Please Login or Register  to view this content.
    Attached Files Attached Files

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Move dynamic matrix data to a single column on different sheet
    By PingTing in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-13-2022, 08:16 PM
  2. [SOLVED] Move data from rpt columns to single row by employee
    By vsynowiec in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 09-11-2019, 12:22 PM
  3. How to move data from a single row to multiple columns
    By gagan2sandhu in forum Excel General
    Replies: 5
    Last Post: 11-21-2017, 07:04 PM
  4. Replies: 2
    Last Post: 01-28-2017, 09:34 AM
  5. Replies: 11
    Last Post: 10-24-2014, 04:50 PM
  6. How do i move like data in columns to single rows?
    By ncsisz in forum Excel General
    Replies: 3
    Last Post: 07-23-2012, 12:09 PM
  7. [SOLVED] Search a range, move data in pairs to a single column
    By wherbjr35 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-02-2011, 01:09 AM

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