+ Reply to Thread
Results 1 to 14 of 14

Multitude of random errors when cycling through workbooks in a folder to copy a range

  1. #1
    Registered User
    Join Date
    07-10-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    12

    Multitude of random errors when cycling through workbooks in a folder to copy a range

    I've spent all day trying to make this code work, and I have gotten dozens of errors, some of which I can fix, and some I can't.

    Please Login or Register  to view this content.
    Right now I'm getting a "Type Mismatch" on the row:

    Please Login or Register  to view this content.
    Ask if you need more information, and thanks for any help.
    Last edited by LXN; 07-22-2013 at 04:34 PM.

  2. #2
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Multitude of random errors when cycling through workbooks in a folder to copy a range

    LXN,
    Welcome to the forum!
    Please use code tags with your code as per forum's rule.
    You have few errors and I guessed some of the lines

    Please Login or Register  to view this content.

  3. #3
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Multitude of random errors when cycling through workbooks in a folder to copy a range

    You have two
    Please Login or Register  to view this content.
    You need to separate between the source and destination books. For ease of reading, you should assign the source book as sourcebook=workbook.open......

  4. #4
    Registered User
    Join Date
    07-10-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    12

    Re: Multitude of random errors when cycling through workbooks in a folder to copy a range

    Thanks of the response! I have edited my post, and changed wbold/wbnew to destinationbook/sourcebook, but I'm not sure how you're telling me to assign the variables. Could you clarify?

  5. #5
    Registered User
    Join Date
    07-10-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    12

    Re: Multitude of random errors when cycling through workbooks in a folder to copy a range

    Thanks of the response! I have edited my post, and changed wbold/wbnew to destinationbook/sourcebook, but I'm not sure how you're telling me to assign the variables. Could you clarify? (I made a reply to my own post by accident in stead of yours. How do I delete that?)

  6. #6
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Multitude of random errors when cycling through workbooks in a folder to copy a range

    You start with this line

    Please Login or Register  to view this content.
    This is where the code will be copied in to

  7. #7
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Multitude of random errors when cycling through workbooks in a folder to copy a range

    Second line

    Please Login or Register  to view this content.

  8. #8
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Multitude of random errors when cycling through workbooks in a folder to copy a range


  9. #9
    Registered User
    Join Date
    07-10-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    12

    Re: Multitude of random errors when cycling through workbooks in a folder to copy a range

    Thanks for the help!

    I made the changes you listed,Also, you linked me to a website. Is that required for this to work, or is it simply an easier way?
    Last edited by LXN; 07-23-2013 at 10:15 AM.

  10. #10
    Registered User
    Join Date
    07-10-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    12

    Re: Multitude of random errors when cycling through workbooks in a folder to copy a range

    I got a 'type mismatch' here:

    Please Login or Register  to view this content.
    Why could that be?

  11. #11
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Multitude of random errors when cycling through workbooks in a folder to copy a range

    There are many lines that need to be changed, so I thought if you follow Ron's code, it will give you a good start, instead of doing by piecemeal.

  12. #12
    Registered User
    Join Date
    07-10-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    12

    Re: Multitude of random errors when cycling through workbooks in a folder to copy a range

    But that link says it's an add-in, not a code?

  13. #13
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Multitude of random errors when cycling through workbooks in a folder to copy a range

    Okay!
    When you click the link, click again the excel tips tab, then 3rd from the list(Topics)-choose copy/paste/merge examples

  14. #14
    Registered User
    Join Date
    07-10-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    12

    Re: Multitude of random errors when cycling through workbooks in a folder to copy a range

    I just got the code running actually! VBA didn't like that I had

    Please Login or Register  to view this content.
    When the variable was a workbook, and not a name.

    Changing it to

    Please Login or Register  to view this content.
    in all such places fixed the problem, along with a few other minor changes.

+ 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. create a compressed folder or zipped folder then copy workbooks to it.
    By Ironman in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-04-2012, 03:56 PM
  2. cycling through all sub-folders in a folder
    By dyesol in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 06-15-2011, 10:31 AM
  3. Replies: 3
    Last Post: 02-06-2011, 05:29 AM
  4. Cycling through files in a folder
    By KateMolloy in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 09-28-2009, 04:18 PM
  5. Cycling through all worbooks in a folder
    By Ben in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 03-15-2006, 06:40 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