+ Reply to Thread
Results 1 to 6 of 6

Copy from 1st workbook and paste to 2nd workbook

  1. #1
    Registered User
    Join Date
    06-25-2007
    Posts
    35

    Copy from 1st workbook and paste to 2nd workbook

    I am trying to create a macro whereas I copy data from an open workbook and paste into a 2nd (unopened) workbook. Not a probelm in itself except I want to run this on a weekly basis and each week (for up to 5 weeks) I need to place the data in to a different cell range.This data in the 2nd workbook is accumulated and expressed in chart form. PLEASE Help as it sending me crazy!!! I've been trying with elseif but without any luck.

    Thanks

    Zipped example files attached

    I want to copy "Gold formatted" cells from "Schedule_new.xls" into "Gold formatted" cells "Fault_codes_monthly.xls" sheet = "weekly faults"
    Attached Files Attached Files

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    I get ref errors when I open your workbooks.

    Assuming you want to write to the next empty cell in Row2 as the first cell try

    Please Login or Register  to view this content.
    You might want to post your code so that I can incorporate it
    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
    06-25-2007
    Posts
    35

    Try Again

    Hi Roy

    Thanks for the prompt reply.

    I've stripped the code right back to something that works. As you can see all it will do is copy and paste from cells "C1:G138" from one workbook to destination cells "C1:G138" on the other.

    Thanks again!!

    Please Login or Register  to view this content.

  4. #4
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    You don't need to select ranges to copy & paste. Also I don't see where you copy to the cells you mention, just to the sheet and whatever range is selected. I also thought you wanted a variable destination. This code might be what you want

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    06-25-2007
    Posts
    35

    Still need to paste to differnet cell range

    Hi Roy

    Thanks for the code.
    To explain more clearly whenever I run the macro I want to paste to cell "C2" in the destination file then use the same macro the following week which will see that cell "C2" contains text so move along to next empty cell (which would then be "H2") and paste there and so on for the remaining weeks of the month. I nearly had it last night with the code you originally gave me but it's still not there.


    Thanks!!

  6. #6
    Registered User
    Join Date
    06-25-2007
    Posts
    35

    Nearly resolved!!

    Thanks Roy!!

    Wasn't far out after all. I've added code for info.
    Works great without Option explicit statement but when incorporated gives "compile error" : "Variable not defined" on answer =
    This must be any easy fix surely???
    Thanks!!

    Please Login or Register  to view this content.

+ 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