+ Reply to Thread
Results 1 to 7 of 7

Macro to copy cells from multiple sheets in workbook to multiple sheets in other workbook

  1. #1
    Registered User
    Join Date
    05-27-2013
    Location
    Buellton, California
    MS-Off Ver
    Excel 2007
    Posts
    26

    Macro to copy cells from multiple sheets in workbook to multiple sheets in other workbook

    Hello,
    I am trying to make a macro that will copy and paste data from specific cells in two sheets of one workbook to specific cells of one sheet in another workbook, then that process should repeat for all the sheets in each of the workbooks.
    What I have so far seems to have a problem somewhere as it does not do anything I can see (does not do the copy/paste part). I may have done the loop wrong or the file navigation part wrong, but I do not know where the error is as it compiles and runs.

    The sheets in the destination workbook (where the values are being pasted) are "XRD-A", "XRD-B", "XRD-C", "XRD-D", "XRD-E", "XRD-F", "XRD-G", "XRD-H", "XRD-I", "XRD-J".
    The sheets in where the data is at are "A-G", "B-G", "C-G", "E-G", "F-G", "G-G", "H-G", "I-G", "J-G", "A-N", "B-N", "C-N", "E-N", "F-N", "G-N", "H-N", "I-N", "J-N"

    The data from "A-G" and "A-N" are supposed to be pasted in "XRD-A" and the same with B and so on...

    Here is what I currently have:
    Please Login or Register  to view this content.
    Which part of the code is incorrect? Should I be doing this in a different way?
    Please help me figure this out.

  2. #2
    Forum Expert Tinbendr's Avatar
    Join Date
    06-26-2012
    Location
    USA
    MS-Off Ver
    Office 2010
    Posts
    2,125

    Re: Macro to copy cells from multiple sheets in workbook to multiple sheets in other workb

    Please Login or Register  to view this content.
    David
    (*) Reputation points appreciated.

  3. #3
    Registered User
    Join Date
    05-27-2013
    Location
    Buellton, California
    MS-Off Ver
    Excel 2007
    Posts
    26

    Re: Macro to copy cells from multiple sheets in workbook to multiple sheets in other workb

    Quote Originally Posted by Tinbendr View Post
    Please Login or Register  to view this content.
    Thanks, that does take out a bit of code and make it cleaner, but I am still having the looping problem.

  4. #4
    Forum Expert Tinbendr's Avatar
    Join Date
    06-26-2012
    Location
    USA
    MS-Off Ver
    Office 2010
    Posts
    2,125

    Re: Macro to copy cells from multiple sheets in workbook to multiple sheets in other workb

    How about this?
    Please Login or Register  to view this content.
    Last edited by Tinbendr; 06-07-2013 at 11:40 AM. Reason: edit code

  5. #5
    Registered User
    Join Date
    05-27-2013
    Location
    Buellton, California
    MS-Off Ver
    Excel 2007
    Posts
    26

    Re: Macro to copy cells from multiple sheets in workbook to multiple sheets in other workb

    Thanks for the quick response, but that still isn't putting the data in the cells. I'm starting to wonder if there is something wrong with the way it accesses the file where the data is coming from.

  6. #6
    Forum Expert Tinbendr's Avatar
    Join Date
    06-26-2012
    Location
    USA
    MS-Off Ver
    Office 2010
    Posts
    2,125

    Re: Macro to copy cells from multiple sheets in workbook to multiple sheets in other workb

    Press F8 and step through the code. Hover over the Range statements and see what the values are.

    If it's not giving an error, then the worksheet naming is probably ok.

  7. #7
    Registered User
    Join Date
    05-27-2013
    Location
    Buellton, California
    MS-Off Ver
    Excel 2007
    Posts
    26

    Re: Macro to copy cells from multiple sheets in workbook to multiple sheets in other workb

    Okay I found the problem. Had a missing "" toward the end of the loop. Thanks!

+ 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