+ Reply to Thread
Results 1 to 3 of 3

Copying all EXCEL workbooks in a Folder to one master workbook

  1. #1
    Registered User
    Join Date
    08-23-2011
    Location
    Toronto,Ontario
    MS-Off Ver
    Excel 2003
    Posts
    48

    Copying all EXCEL workbooks in a Folder to one master workbook

    I save my business invoices in EXCEL files in a folder for each year. I want to create a master file that contains all of the year's invoices. I need programming code that will loop through each workbook in the yearly folder and copy and paste it into the master file and then close the file being copied. When I close out the file being copied I don't want to see any dialog boxes asking me if I want "To save changes", which happens manually and will stop the code. Most of my invoices were self totaling with formulas so when I open them now I will be copying them and "Paste Special" them with the values that go in the formulas. That part I can take care of. I just need the basic code structure to loop through all the files. I have seen different coding structures to accomplish this task with different ideologies so please supply comments in the code to make it easy to understand. I have EXCEL 2003.

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 insider Version 2505 Win 11
    Posts
    24,755

    Re: Copying all EXCEL workbooks in a Folder to one master workbook

    A couple of questions for clarification.
    1. Are all files to be copied in the same folder?
    2. Are all files to be copied contain the same number of sheets? 1?
    3. Are all files to be copied assuming each one is only one sheet to be inserted in its own sheet?
    4. If 3 is true, then how do you want to name the sheets? Sheet1, Sheet2, or something else.
    5. Approximately how many files to be copied?

    A sample couple of dummy files to see what they look like would be helpful. You can upload them using the Go Advanced button and then follow the wizard.
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  3. #3
    Registered User
    Join Date
    08-23-2011
    Location
    Toronto,Ontario
    MS-Off Ver
    Excel 2003
    Posts
    48

    Re: Copying all EXCEL workbooks in a Folder to one master workbook

    Quote Originally Posted by alansidman View Post
    A couple of questions for clarification.
    1. Are all files to be copied in the same folder?
    2. Are all files to be copied contain the same number of sheets? 1?
    3. Are all files to be copied assuming each one is only one sheet to be inserted in its own sheet?
    4. If 3 is true, then how do you want to name the sheets? Sheet1, Sheet2, or something else.
    5. Approximately how many files to be copied?

    A sample couple of dummy files to see what they look like would be helpful. You can upload them using the Go Advanced button and then follow the wizard.
    1. All worksheets are to be copied into a master file "All 2013 Invoices.xls" with 1 worksheet in the workbook in a different folder, "2013". The invoices are kept in "Invoices 201?", which is a subfolder of "2013"
    2. All files are 1 worksheet only.
    3. Each sheet will be copied onto a sequential space 40 rows long and 10 columns wide. The new sheets will be positioned using "Cells(rNewRow,1)" on the master file. rNewRow will be changed in "All 2013 Invoices.xls" by "rNewRow = rNewRow+40" before being copied into the master file.
    4. The worksheets do not have to be named because the invoice number is contained on each worksheet. When the master file is completed I will be inserting a column to the left margin to be used as an index.
    5. When each new file is opened I will use "Range("A1:J40").Select " then "Selecion.Copy" will be used to copy the worksheet for pasting into the master file.

    There is nothing special about the files. They are files that have my company name on the top, my address, an invoice number and description of labour and parts with cost amounts put into the far right column for totaling.
    5. There about 70 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. copying similar named worksheets from multiple workbooks into a master workbook
    By bradpeh in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 10-24-2013, 04:41 AM
  2. [SOLVED] Copying data from other workbooks and pasting into master workbook
    By jcook1100 in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 07-15-2013, 08:03 AM
  3. [SOLVED] Macro for Copying Cels from All Workbooks to a Single Master Workbook
    By JohnnyJ2013 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 05-25-2013, 05:51 AM
  4. Conditioned copying/pasting of specific cells from multiple workbooks to master workbook
    By Ziad Homaidan in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-06-2013, 11:39 AM
  5. Replies: 1
    Last Post: 11-21-2012, 11:23 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