Need Help with My Existing Code to merge sheets

  • Hi All,


    The attached sheet has my sample data - forum.ozgrid.com/index.php?attachment/65866/ .


    I was able to build code to merge data in all sheets into a single sheet (all headers in all sheets are consistent). Data to be merged with headers starts on row7.


    My aim is (and I am struggling here) is to run this code from a different workbook say "MergedSheets" which will



    • Prompt the user to select the target file from which sheets are to be merged.
    • Combine/merge all data sheets into one but this combined result should get added as a new worksheet in the "MergedSheets" worksheet with tab name as today's date.
    • Everyday/everytime this macro is run a new worksheet with today's date as name should get populated alongside yesterday's sheet.


    My current code is as below:


  • Re: Need Help with My Existing Code to merge sheets


    Try this in master "MergedSheets" workbook

    We now have a reputation system in place. If my reply helped please "Like" the reply by clicking the "Like" icon at bottom right of my reply.

  • Re: Need Help with My Existing Code to merge sheets


    Thanks KjBox!!


    This worked and I was able to figure out much of the code :)


    Just one request...in the sample workbook there were 3 columns...in reality there maybe several with varying column numbers everyday (though number of columns and headers will always be consistent and in same order). Is there anyway to account for that?


    Thanks.

  • Re: Need Help with My Existing Code to merge sheets


    Try this


    Change

    Code
    Hdrs = Array("Name", "ID", "Place", "Header4", "Header5", "Header6", _
                    "Header7", "Header8", "Header9", "Header10")


    To the names of your actual headers.

    We now have a reputation system in place. If my reply helped please "Like" the reply by clicking the "Like" icon at bottom right of my reply.

  • Re: Need Help with My Existing Code to merge sheets


    This is better, gets headers directly from sheet, no need to change anything.

    We now have a reputation system in place. If my reply helped please "Like" the reply by clicking the "Like" icon at bottom right of my reply.

  • Re: Need Help with My Existing Code to merge sheets


    You're welcome

    We now have a reputation system in place. If my reply helped please "Like" the reply by clicking the "Like" icon at bottom right of my reply.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!