+ Reply to Thread
Results 1 to 13 of 13

Cut/copy from columns into one vertical column.

  1. #1
    Registered User
    Join Date
    02-02-2013
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    46

    Cut/copy from columns into one vertical column.

    I have an excel workbook (1 sheet). The sheet contains over 1000 columns with a lot of data. All columns are different, one can have 20 rows, another 10 rows, other 55 row etc. (maximum column length reaches 400th row). Is there a function or macro that will combine all of this data into one vertical column without having to individually cut and paste each one into the new column?

  2. #2
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Cut/copy from columns into one vertical column.

    Yes, it is doable. Please attach a sample

  3. #3
    Forum Expert
    Join Date
    10-10-2008
    Location
    Northeast Pennsylvania, USA
    MS-Off Ver
    Excel 2007
    Posts
    2,387

    Re: Cut/copy from columns into one vertical column.

    andrewzzz,

    To get the most precise answer, it is best to upload/attach a sample workbook (sensitive data scrubbed/removed/changed) that contains an example of your raw data on one worksheet, and on another worksheet your desired results.

    The structure and data types of the sample workbook must exactly duplicate the real workbook. Include a clear and explicit explanation of your requirements.

    To attach your workbook, scroll down and click on the Go Advanced button, then scroll down and click on the Manage Attachments button.
    Have a great day,
    Stan

    Windows 10, Excel 2007, on a PC.

    If you are satisfied with the solution(s) provided, please mark your thread as Solved by clicking EDIT in your original post, click GO ADVANCED and set the PREFIX box to SOLVED.

  4. #4
    Registered User
    Join Date
    02-02-2013
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    46

    Re: Cut/copy from columns into one vertical column.

    AB33, thank you for your quick reply. I have attached a sample. So I have attached the samples. There are 6 columns there (A-F) and each column has different length. The total number of cells containing data is 250. This means that I want all the cells to be in one column, reaching 250 rows. Thank you.
    Attached Files Attached Files

  5. #5
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Cut/copy from columns into one vertical column.

    This should do, assuming you have sheets1 and 2. sheeet2 is the output sheet.

    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    02-02-2013
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    46

    Re: Cut/copy from columns into one vertical column.

    AB33, thank you so much. I tried to run the script, and what it did - it copied only the first column from Sheet 1 into first column in Sheet 2, and left the cell A1 in Sheet 2 blank. Could you check please?

  7. #7
    Forum Expert mike7952's Avatar
    Join Date
    12-17-2011
    Location
    Florida
    MS-Off Ver
    Excel 2007, Excel 2016
    Posts
    3,519

    Re: Cut/copy from columns into one vertical column.

    Give this a try

    Please Login or Register  to view this content.
    Last edited by mike7952; 03-31-2013 at 09:16 AM.
    Thanks,
    Mike

    If you are satisfied with the solution(s) provided, please mark your thread as Solved.
    Select Thread Tools-> Mark thread as Solved.

  8. #8
    Registered User
    Join Date
    02-02-2013
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    46

    Re: Cut/copy from columns into one vertical column.

    Mike, thank you, you're a genius.

  9. #9
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Cut/copy from columns into one vertical column.

    Please Login or Register  to view this content.

  10. #10
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Cut/copy from columns into one vertical column.

    Andrew,
    My first code also works, but with many blanks in between cells. I did it with out seeing your book. My second code works with out leaving any blank rows.

  11. #11
    Registered User
    Join Date
    02-02-2013
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    46

    Re: Cut/copy from columns into one vertical column.

    Hi AB33, thank you. I tried to use your second code, but it says runtime error "7", not sure what that would mean?

  12. #12
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Cut/copy from columns into one vertical column.

    I do not know why you getting any error. Please see attach and let me know in which line of the code you are getting the error?
    Attached Files Attached Files

  13. #13
    Forum Expert
    Join Date
    10-10-2008
    Location
    Northeast Pennsylvania, USA
    MS-Off Ver
    Excel 2007
    Posts
    2,387

    Re: Cut/copy from columns into one vertical column.

    andrewzzz,

    The following macro will produce a new list in Sheet2 in the following order:
    Sheet1 column A
    Sheet1 column B
    Sheet1 column C
    Sheet1 column D
    Sheet1 column E
    Sheet1 column F


    Please TEST this FIRST in a COPY of your workbook (always make a backup copy before trying new code, you never know what you might lose).
    Please Login or Register  to view this content.
    Before you use the macro with Excel 2007 or newer, save your workbook, Save As, a macro enabled workbook with the file extension .xlsm

    Then run the CombineColumns macro.

+ 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