+ Reply to Thread
Results 1 to 5 of 5

Help with code to paste copied data into a destination workbook

  1. #1
    Registered User
    Join Date
    06-18-2009
    Location
    Northampton, England
    MS-Off Ver
    Excel 2013/2016
    Posts
    40

    Help with code to paste copied data into a destination workbook

    Hi,

    I have struggled to modify existing code I've found around the internet so I've started to make my own.

    What I'm trying to do is to copy a daily diary log at the end of the week after it's been checked. So the Diary Log.xlsm file will already be open and there will be a button for the supervisor to click to archive the data to a Master workbook. There will be 50 of these files and various different people checking the data is correct and then archiving to the same Destination workbook. The Destination workbook will be closed initially, opened with the code and the copied range will then need to be pasted into the Destination workbook in the next empty row.

    So far I have managed to open the Destination workbook and copy the range which can be any number of rows. I am now stuck on the code to paste it into the Master workbook. Please could you look at my code and tell me where I'm going wrong. The code under 'Paste to destination workbook gives a Run-time error '1004' Application-defined or object-defined error message

    The code will need to paste into Row B for the first export (Headings in Row A) and then the next available row from then on. Also there are named ranges in the Daily Log file which I don't want to copy over as that produces an 'error' on the second export with a pop-up saying the name already exists on the target worksheet. (Found this out on a previous attempt to modify someone else's code). Will a Paste Values option avoid copying the named ranges?

    Any pointers on how I can do the following would also be helpful....Once the data has been pasted into the destination workbook I want to clear the data from row B14:014 down to B100:O100 as a range in the Diary Log file, save and close the destination file and also save but not close the Diary Log file.

    The code I have so far is:

    Please Login or Register  to view this content.
    I have attached the Diary Log.xlsm file and the Destination.xlsm files to give you an idea of what I'm trying to do.

    Thanks for any help you can give me...
    Attached Files Attached Files

  2. #2
    Registered User
    Join Date
    06-18-2009
    Location
    Northampton, England
    MS-Off Ver
    Excel 2013/2016
    Posts
    40

    Re: Help with code to paste copied data into a destination workbook

    Can anyone help tell me where I'm going wrong with the line of code beneath 'Paste to destination workbook. I need the code to find the last row and then paste the copied data into the row beneath it?

  3. #3
    Registered User
    Join Date
    06-18-2009
    Location
    Northampton, England
    MS-Off Ver
    Excel 2013/2016
    Posts
    40

    Re: Help with code to paste copied data into a destination workbook

    Ok, no problem, I'll try somewhere else

  4. #4
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Help with code to paste copied data into a destination workbook

    You aren't referring to the range you want to paste to properly.

    Here there's no row for B.
    Please Login or Register  to view this content.
    Where do you actually want to paste to?

    Is it the first empty cell in column A?
    Please Login or Register  to view this content.
    If posting code please use code tags, see here.

  5. #5
    Registered User
    Join Date
    06-18-2009
    Location
    Northampton, England
    MS-Off Ver
    Excel 2013/2016
    Posts
    40

    Re: Help with code to paste copied data into a destination workbook

    Hi Norie, yes to the first empty cell in column A...thanks for replying

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] paste source filepath information to destination book (code included)
    By macrorookie in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 02-24-2014, 03:15 PM
  2. [SOLVED] When data is copied to another workbook, hyperlinks as not copied or they don't work
    By KK1234 in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 01-17-2014, 06:46 AM
  3. Replies: 0
    Last Post: 03-05-2013, 07:34 PM
  4. Get data from source workbook and paste to destination in change format
    By farrukh in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-03-2012, 01:47 AM
  5. Set copied data from closed workbook, paste into desired location.
    By Kenji in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-28-2009, 11:28 AM

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