+ Reply to Thread
Results 1 to 7 of 7

Transfer/Copy Data from one workbook to another

  1. #1
    Registered User
    Join Date
    10-24-2012
    Location
    Louisville, KY
    MS-Off Ver
    Excel 2010
    Posts
    5

    Transfer/Copy Data from one workbook to another

    Hello all,

    I am currently writing macros that will transfer data from a template file, to what is essentially a log file. How does one go about copying data from one workbook to another. I have currently been able to transfer data from one sheet to another using the following code:

    Please Login or Register  to view this content.
    How could I get this code to write to another workbook. I believe that I read in order to paste another file it must be opened. Is that correct? Any help would be much appreciated.

    Thanks,
    Scott

    Moderator's note: code tags added for you
    Last edited by FDibbins; 10-26-2012 at 08:38 PM.

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,050

    Re: Transfer/Copy Data from one workbook to another

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code. Posting code without them makes your code hard to read and difficult to be copied for testing. Highlight your code and click the # at the top of your post window. For more information about these and other tags, found here
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  3. #3
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,327

    Re: Transfer/Copy Data from one workbook to another

    Hi Scott,

    Instead of trying to read this code, it would help if you just laid out the particular's.

    Can we start with what you are trying to accomplish?
    HTH
    Regards, Jeff

  4. #4
    Registered User
    Join Date
    10-24-2012
    Location
    Louisville, KY
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: Transfer/Copy Data from one workbook to another

    Hi Jeff,

    I am trying to write a macro that will copy/paste certain cells from one workbook to another workbook. So basically, the values entered in WB1 I want transfered to WB2.

  5. #5
    Registered User
    Join Date
    10-24-2012
    Location
    Louisville, KY
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: Transfer/Copy Data from one workbook to another

    I should also note that I need the macros to work with any workbook. The reason being that there are 12 different files that I need to pull from (one for each month). I will be pulling the info from the exact same cells each time. I really just need to know where and how to name the source WorkBook in a manner that whenever the i.e. (January, February, March etc) workbook files are being used it can still paste the correct values into the destination file which will not change.

  6. #6
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,327

    Re: Transfer/Copy Data from one workbook to another

    There are many ways to go with this that is why we look for specifics up front.

    Here is an example I worked up, but with the additional info you posted it will take some more effort (at least for me).

    Option Explicit

    Please Login or Register  to view this content.

  7. #7
    Forum Guru
    Join Date
    03-12-2010
    Location
    Canada
    MS-Off Ver
    2010 and 2013
    Posts
    4,418

    Re: Transfer/Copy Data from one workbook to another

    Hi Scott,

    Maybe this example can help.

    I have a workbook that is called AllYear and two other workbooks (Jan and Feb). I want to extract the exact cell from both Jan and Feb and put them in AllYear. Just put all the files on your desktop and the macro should recognize them.

    Please Login or Register  to view this content.
    Let me know if things are more clear now.

    abousetta
    Attached Files Attached Files
    Last edited by abousetta; 10-26-2012 at 10:29 PM.
    Please consider:

    Thanking those who helped you. Click the star icon in the lower left part of the contributor's post and add Reputation.
    Cleaning up when you're done. Mark your thread [SOLVED] if you received your answer.

+ 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