+ Reply to Thread
Results 1 to 6 of 6

Copy and Paste in closed workbook

  1. #1
    Valued Forum Contributor
    Join Date
    01-18-2007
    Location
    Georgia
    MS-Off Ver
    2010
    Posts
    4,434

    Copy and Paste in closed workbook

    Hello:

    I need a VB Code to copy the data from current file, Sheet "Summary" Range B5:E30 to closed workbook at path :C:\Temp\2014-File.xls\ Sheet "Employees at location T2.
    Basically i do not want to manually open the destination file and do and paste.

    Please let me know if you have any questions.
    Thanks.


    Riz

  2. #2
    Valued Forum Contributor ranman256's Avatar
    Join Date
    07-29-2012
    Location
    Kentucky
    MS-Off Ver
    Excel 2003
    Posts
    1,177

    Re: Copy and Paste in closed workbook

    start with an empty wb.
    Record a macro (to PERSONAL WORKBOOK)
    open the workbook
    copy
    paste
    save
    close
    end recording.

    your macro will work w/o you 'opening' the workbook.

  3. #3
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Copy and Paste in closed workbook

    Hello rizmomin,

    Code for reading and writing from closed workbooks has restrictions. So, to be sure that the code will work correctly it would help to have a copy. PLease redact any sensitive information from the workbook before you post it.

    FYI ranman256 - You can not record the macro code to read or write to a closed workbook. To do so requires using Active Data Objects (ADO).
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  4. #4
    Valued Forum Contributor
    Join Date
    01-18-2007
    Location
    Georgia
    MS-Off Ver
    2010
    Posts
    4,434

    Re: Copy and Paste in closed workbook

    Hi Leith:

    Thanks for your great input.
    Please find attached 2 files, one Source and other one Destination file(08_2014_DailySales).
    Data for Source file will be in "Summary" tab as highlighted.
    These data needs to be pasted to closed workbook (name of the file in cell c1 of source file) in Employees Sheet at T2.

    I hope this is clear and VB code can do the trick.
    Please let me know if you have any questions.
    Thanks.


    Riz
    Attached Files Attached Files

  5. #5
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Copy and Paste in closed workbook

    Hello Riz,

    Thanks for posting the workbooks. Makes it easier to write and test the code.

  6. #6
    Valued Forum Contributor
    Join Date
    01-18-2007
    Location
    Georgia
    MS-Off Ver
    2010
    Posts
    4,434

    Re: Copy and Paste in closed workbook

    Hi Leith and Others:

    I am trying to use below code to accomplish my goal but it is not gong any further and it is erroring out at : Value1 = Sheets("Summary").Range("B5:E33")


    Please Login or Register  to view this content.
    Please help to resolve.
    Thanks
    Riz
    Last edited by rizmomin; 09-12-2014 at 09:07 AM.

+ 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. Copy in One Workbook and Paste to Another Whether Closed or Open
    By uberathlete in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-05-2014, 06:47 AM
  2. [SOLVED] Code to copy data from a closed workbook and paste in active workbook using named range.
    By paullie1912 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 02-28-2014, 02:38 AM
  3. Copy and Paste from a Closed Workbook
    By Sean Ross in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-12-2013, 10:26 AM
  4. Copy 2 sheets from a open workbook and paste to a closed workbook
    By grimston in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-27-2012, 03:27 PM
  5. Macro to copy over and paste data in to a work sheet from a closed workbook
    By munkee in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-24-2009, 04:04 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