+ Reply to Thread
Results 1 to 10 of 10

Combine multiple columns into one column with header and date in another column

  1. #1
    Registered User
    Join Date
    08-28-2012
    Location
    Texas
    MS-Off Ver
    Excel 2010
    Posts
    4

    Combine multiple columns into one column with header and date in another column

    Attached is a workbook where the 'Raw Data' sheet changes frequently and the 'Output' sheet needs to combine multiple columns from 'Raw Data' into one continuous column. On any given day the number of columns and the number or rows can change so I need the VBA to be dynamic. I need to be able to start out with the data in 'Raw Data' and end up with the data in 'Output'. Please let me know if you need clarification. I really appreciate the help.Example.xlsx

  2. #2
    Valued Forum Contributor
    Join Date
    02-12-2011
    Location
    The Netherlands
    MS-Off Ver
    365
    Posts
    818

    Re: Combine multiple columns into one column with header and date in another column

    Please Login or Register  to view this content.
    Ps. Your worksheet "Output" is written as "Ouput" in your example.
    Attached Files Attached Files
    Last edited by HSV; 11-09-2012 at 05:36 PM. Reason: Ps.
    Kind regards, Harry.

  3. #3
    Forum Expert
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2019
    Posts
    4,168

    Re: Combine multiple columns into one column with header and date in another column

    hi JJadams, 2 options:

    1. Button "Run": values go without empties in between as in your sample file
    2. Button "Run1": values may have empties in between, more general option
    Attached Files Attached Files

  4. #4
    Registered User
    Join Date
    08-28-2012
    Location
    Texas
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Combine multiple columns into one column with header and date in another column

    Thanks watersev. Option 2 works great. I would like to be able to specify specific columns (i.e. columns H,I, and J) in a specific sheet (i.e. 'Output') for the results to populate rather than it populating a new sheet everytime. How would I add that into the VBA?

  5. #5
    Forum Expert
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2019
    Posts
    4,168

    Re: Combine multiple columns into one column with header and date in another column

    do you mean sort of that? Press ALT+N on the sheet to output data. The sheet should have headers: Name, Date, Amount
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    08-28-2012
    Location
    Texas
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Combine multiple columns into one column with header and date in another column

    It doesn't seem to be working properly if there is a column header but no related data. In the attached, 'Balloon' and 'Circus' have no data but the VBA is relating data from 'Peach' to both 'Balloon' and 'Circus' anyways. Thanks again.Example (1).xlsm

  7. #7
    Valued Forum Contributor
    Join Date
    02-12-2011
    Location
    The Netherlands
    MS-Off Ver
    365
    Posts
    818

    Re: Combine multiple columns into one column with header and date in another column

    Why I read in the comments none of my code...... not tested?

  8. #8
    Registered User
    Join Date
    08-28-2012
    Location
    Texas
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Combine multiple columns into one column with header and date in another column

    HSV,

    I tested your code and it worked good for the specific example that I posted but it doesn't seem to be as dynamic with blank cells and such. That is why I decided to use the code from waterserv, but I do appreciate your input.

  9. #9
    Valued Forum Contributor
    Join Date
    02-12-2011
    Location
    The Netherlands
    MS-Off Ver
    365
    Posts
    818

    Re: Combine multiple columns into one column with header and date in another column

    JJadams,

    My code works fine to me in your last posted example.

  10. #10
    Forum Expert
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2019
    Posts
    4,168

    Re: Combine multiple columns into one column with header and date in another column

    please check attachment, code corrected
    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)

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