+ Reply to Thread
Results 1 to 6 of 6

Problem looping through multiple files to copy/paste into master workbook

  1. #1
    Registered User
    Join Date
    04-25-2015
    Location
    Pointe au Baril, ON
    MS-Off Ver
    2013
    Posts
    11

    Problem looping through multiple files to copy/paste into master workbook

    Hi all,

    The following code has been a work in progress. Basically it looks at a summary sheet for a day's worth of salesperson's invoices, looping through up to 40 invoice "lines" and then loops through another series of lines for payment information. I have been able to run this code selecting one file at a time. Since I run this daily on up to six files, I tried adapting some code to loop through multiple files. The code hits the error handler and tells me no file was selected (even though it opened the first file). I would greatly appreciate any help if someone can spot why this happens.

    Thanks in advance!


    Please Login or Register  to view this content.

  2. #2
    Forum Contributor amartinez988's Avatar
    Join Date
    05-04-2015
    Location
    Miami
    MS-Off Ver
    Office 2010
    Posts
    183

    Re: Problem looping through multiple files to copy/paste into master workbook

    In my case the error is triggering because is trying to assign the workbook "All Invoices Master.xlsm" and of course that workbook is not open.

  3. #3
    Valued Forum Contributor ranman256's Avatar
    Join Date
    07-29-2012
    Location
    Kentucky
    MS-Off Ver
    Excel 2003
    Posts
    1,189

    Re: Problem looping through multiple files to copy/paste into master workbook

    Its possible you have an incorrect error...the handler is built wrong...
    correct to below to see REAL error:

    MsgBox Err.Description, , Err
    'MsgBox "No file was selected."

  4. #4
    Forum Contributor amartinez988's Avatar
    Join Date
    05-04-2015
    Location
    Miami
    MS-Off Ver
    Office 2010
    Posts
    183

    Re: Problem looping through multiple files to copy/paste into master workbook

    Ok I think this will solve your problem, JUST MAKE SURE THAT THE WORKBOOKS YOU ARE OPENING ALL HAVE THE SPECIFIED SHEETS.

    Please Login or Register  to view this content.
    Let us know,

  5. #5
    Registered User
    Join Date
    04-25-2015
    Location
    Pointe au Baril, ON
    MS-Off Ver
    2013
    Posts
    11

    Re: Problem looping through multiple files to copy/paste into master workbook

    Thank you both for the quick replies. I run the macro from the "All Invoices Master" file so it is open. Sorry, I should have clarified. For accuracy sake, I will fix the error handler, too.

    I actually just figured it out - the next reference in the code to FileName needed the subscript (j) included, and now it works.

    Thanks again!

  6. #6
    Forum Contributor amartinez988's Avatar
    Join Date
    05-04-2015
    Location
    Miami
    MS-Off Ver
    Office 2010
    Posts
    183

    Re: Problem looping through multiple files to copy/paste into master workbook

    Exactly! Please don't forget to close post as solved and add reputation in case any of the members help you in any way

+ 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. Copy/Paste data from master workbook to multiple spreadsheet
    By lilbamboo in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-17-2013, 04:05 PM
  2. Open Multiple Files, Copy Worksheet, Paste in to Specific Tab in Original Workbook
    By freybe06 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 05-30-2013, 10:27 AM
  3. Copy a Template workbook ans paste in a multiple Files in a Folder
    By arvind1979_3 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-24-2013, 09:07 AM
  4. copy paste from multiple workbooks to master workbook
    By ravinder_tigh in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-18-2009, 02:29 AM

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