+ Reply to Thread
Results 1 to 3 of 3

Copy and Paste Data between Two Open Workbooks

  1. #1
    Registered User
    Join Date
    05-20-2010
    Location
    Washington DC
    MS-Off Ver
    Excel 2003
    Posts
    20

    Copy and Paste Data between Two Open Workbooks

    I want to programmatically copy three ranges from one open workbook and paste those ranges into the same cell addresses of another open workbook. The name of the receiving workbook will vary, so I can't write its name into the code.

    The code for copying the ranges looks like this:


    Please Login or Register  to view this content.

    This successfully puts the three ranges on the clipboard. My problem has been creating a macro on the workbook to receive the pasted material. I don't know how to write the macro to paste each range itno the corresponding cells.

    Someone suggested something like this:

    Please Login or Register  to view this content.
    But that would only copy/paste data within a notebook.

    Does anyone have any ideas? I've been at this for hours.

    Thank you
    Last edited by 3link; 03-25-2011 at 11:22 AM.

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Copy and Paste Data between Two Open Workbooks

    You need to get the name somehow unless you make sure the destination workbook is active when the code is run. If so
    Please Login or Register  to view this content.
    Amend the sheet names according to requirements
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  3. #3
    Registered User
    Join Date
    05-20-2010
    Location
    Washington DC
    MS-Off Ver
    Excel 2003
    Posts
    20

    Re: Copy and Paste Data between Two Open Workbooks

    Quote Originally Posted by royUK View Post
    You need to get the name somehow unless you make sure the destination workbook is active when the code is run. If so
    Please Login or Register  to view this content.
    Amend the sheet names according to requirements
    Thank you, but I can't seem to get this to work. I plugged in my sheet and range info and ran the macro from the destination file. Nothing happened.

    I tried running the macro on two new workbooks. I put several values in range A1:A10 in one workbook and ran the macro from the other workbook:

    Please Login or Register  to view this content.
    Both workbooks were open. There was no effect. I know I'm doing something horribly wrong. Will someone please put me out of my misery?

+ 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