+ Reply to Thread
Results 1 to 5 of 5

Copy paste from one worbook to another workbook

  1. #1
    Forum Contributor
    Join Date
    06-15-2007
    Location
    Scotland
    Posts
    142

    Red face Copy paste from one worbook to another workbook

    Hi guys,
    I have a sheet called 2.xls, with a button which has asigened the following code:
    Please Login or Register  to view this content.
    the idea is to open 1.xls copy the data from the sheet1 range f4:f14 and paste in 2.xls in sheet1 starting from cell F4
    the macro open 1.xls but I get run time error 1004 Select method of class range has failed. Does any body know what is wrong here?
    Thanks very much.
    Last edited by VBA Noob; 01-22-2008 at 06:06 PM.

  2. #2
    Valued Forum Contributor
    Join Date
    08-26-2006
    Location
    -
    MS-Off Ver
    2010
    Posts
    388
    I think you need to specify the worksheet before the range on the first select:
    Please Login or Register  to view this content.
    Also when copying and pasting there is no need to activate or select anything. Look at the Copy Method example in VBA help.
    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    11-27-2007
    Posts
    16
    I'm trying to do something similar;
    If I understand correctly, this bit of code is copying a range from the active workbook into a second (open but inactive) workbook. How then would I re-arrange the code to go the other way; copy something from an open but inactive workbook into the active workbook?

    Please Login or Register  to view this content.

  4. #4
    Valued Forum Contributor
    Join Date
    08-26-2006
    Location
    -
    MS-Off Ver
    2010
    Posts
    388
    That earlier piece of code was incorrect, it should have been:
    Please Login or Register  to view this content.
    Quote Originally Posted by sbrandt
    How then would I re-arrange the code to go the other way; copy something from an open but inactive workbook into the active workbook?
    I would do it like this:

    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    06-15-2007
    Location
    Scotland
    Posts
    142

    Thumbs up

    thanks very much last piece of code works as i wanted

+ 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