+ Reply to Thread
Results 1 to 12 of 12

How do I stack the contents of 3 columns vertically into one column using VBA

  1. #1
    Registered User
    Join Date
    11-15-2012
    Location
    San Jose, CA
    MS-Off Ver
    Office 2019 (in a VM on my mac)
    Posts
    34

    How do I stack the contents of 3 columns vertically into one column using VBA

    An example:
    Col AD Col AE Col AF
    1 2 3
    4 5 6
    7 8 9

    Result in col AJ should be
    1
    4
    7
    2
    5
    8
    3
    6
    9
    The results should ignore blank cells after the last non-blank cell in ciolumns AD, AE and AF.
    Last edited by MartinLiss; 08-28-2023 at 05:40 PM.

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

    Re: How do I stack the contents of 3 columns vertically into one column using VBA

    If all 3 Columns are the same length with data.
    Please Login or Register  to view this content.
    Or
    Please Login or Register  to view this content.
    Last edited by jolivanes; 08-28-2023 at 07:18 PM.
    Experience trumps academics every day of the week and twice on Sunday.

  3. #3
    Registered User
    Join Date
    11-15-2012
    Location
    San Jose, CA
    MS-Off Ver
    Office 2019 (in a VM on my mac)
    Posts
    34

    Re: How do I stack the contents of 3 columns vertically into one column using VBA

    Thanks. I know how to do it without Transpose but I'd like to do it with transpose.

  4. #4
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Arrow Re: How do I stack the contents of 3 columns vertically into one column using VBA


    As TRANSPOSE worksheet function is very not appropriate here …

  5. #5
    Registered User
    Join Date
    11-15-2012
    Location
    San Jose, CA
    MS-Off Ver
    Office 2019 (in a VM on my mac)
    Posts
    34

    Re: How do I stack the contents of 3 columns vertically into one column using VBA

    I'm not asking for a Transpose function, but rather transpose VBA code like the following which doesn't and is not intended to do what I want.

    Please Login or Register  to view this content.
    Last edited by AliGW; 08-29-2023 at 01:44 AM. Reason: Code tags added. Please read the guidelines on the rules page.

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

    Re: How do I stack the contents of 3 columns vertically into one column using VBA

    Are all the columns the same length?

    If you use transpose, the outcome will be different from what you ask for in Post #1.
    Last edited by jolivanes; 08-28-2023 at 09:27 PM.

  7. #7
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Arrow Re: How do I stack the contents of 3 columns vertically into one column using VBA


    As the Paste Transpose is exactly the same as TRANSPOSE worksheet function and
    as your need has nothing to do with any transposition …

  8. #8
    Valued Forum Contributor
    Join Date
    06-27-2010
    Location
    sYRIA
    MS-Off Ver
    Excel 2013
    Posts
    669

    Re: How do I stack the contents of 3 columns vertically into one column using VBA

    Please Login or Register  to view this content.

  9. #9
    Forum Expert
    Join Date
    10-11-2021
    Location
    Netherlands
    MS-Off Ver
    365
    Posts
    1,386

    Re: How do I stack the contents of 3 columns vertically into one column using VBA

    Just go this way, without transpose

    Please Login or Register  to view this content.
    Last edited by JEC.; 08-29-2023 at 06:05 AM.

  10. #10
    Forum Expert
    Join Date
    10-11-2021
    Location
    Netherlands
    MS-Off Ver
    365
    Posts
    1,386

    Re: How do I stack the contents of 3 columns vertically into one column using VBA

    With transpose

    Please Login or Register  to view this content.
    Last edited by JEC.; 08-29-2023 at 06:05 AM.

  11. #11
    Registered User
    Join Date
    11-15-2012
    Location
    San Jose, CA
    MS-Off Ver
    Office 2019 (in a VM on my mac)
    Posts
    34

    Re: How do I stack the contents of 3 columns vertically into one column using VBA

    Thank you mohadin, your transpose solution works.

    JEC I tried your solution and I think your use of a named range is clever but the code gave me a type mismatch error on the second line of the macro.

  12. #12
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Arrow Re: How do I stack the contents of 3 columns vertically into one column using VBA


    Quote Originally Posted by MartinLiss View Post
    Thank you mohadin, your transpose solution works.
    As his final transpose cancel the previous ones so it's like not using any transpose,
    instead of doing A + B it's like doing A - - B, the minus signs are the transpose so useless …

    Like you can check yourself just copying a range then pasting it with transpose activated.

+ 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] How to vertically stack two range?
    By Ariful Islam in forum Excel Formulas & Functions
    Replies: 14
    Last Post: 03-02-2023, 11:08 AM
  2. [SOLVED] How to stack one column of data into two columns?
    By Ariful Islam in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 02-26-2023, 01:48 PM
  3. Replies: 14
    Last Post: 03-17-2022, 12:42 PM
  4. [SOLVED] Stack 4 columns into one column.
    By archvanarl in forum Excel General
    Replies: 2
    Last Post: 12-22-2018, 09:29 PM
  5. [SOLVED] Stack horizontal rows vertically automatically
    By HamSandvich in forum Excel General
    Replies: 8
    Last Post: 09-28-2014, 06:39 PM
  6. Replies: 2
    Last Post: 03-13-2012, 05:40 AM
  7. Transpose vertically down one column instead of across all columns
    By galileo007 in forum Excel Programming / VBA / Macros
    Replies: 20
    Last Post: 07-05-2010, 11:44 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