+ Reply to Thread
Results 1 to 3 of 3

Open workbook, copy rows, paste to end of current workbook

  1. #1
    Registered User
    Join Date
    06-18-2013
    Location
    london
    MS-Off Ver
    Excel 2010
    Posts
    8

    Open workbook, copy rows, paste to end of current workbook

    Hi,

    I am trying to put together some code to do the following
    1. Open OLDDATA workbook (using the dialog box, file name and path will be different every time)
    2. Copy all rows except row1 from OLDDATA, olddatasheet (this is the only worksheet in the file) to the workbook that the macro was run from (workbook=NEWDATA, sheet=newdatasheet. this will always be called the same). newdatasheet will already have data so i need it to copy to the next available row
    3. Close OLDDATA workbook without saving

    Can anyone help? my attempt is below...

    Please Login or Register  to view this content.

  2. #2
    Valued Forum Contributor Naveed Raza's Avatar
    Join Date
    11-04-2012
    Location
    India, Hyderabad
    MS-Off Ver
    Excel, Access 2007/2010
    Posts
    1,338

    Re: Open workbook, copy rows, paste to end of current workbook

    try this code.......
    Please Login or Register  to view this content.
    or else find the two attached file for validating..

    Hope this will work
    Attached Files Attached Files
    Thanks - Naveed
    -----------------------------
    If the suggestion helps you, then Click * to Add Reputation
    To Attach File: Go Advanced>>Manage Attachments>>Add Files (In Top Right Corner)>>SelectFiles>>.........Locate Your File(s)>>Upload Files>>Done (In Bottom Right)
    1. Use [code] code tags [\code]. It keeps posts clean, easy-to-read, and maintains VBA formatting.
    2. If you are happy with a solution to your problem, mark the thread as [SOLVED] using the tools at the top.

  3. #3
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: Open workbook, copy rows, paste to end of current workbook

    Hi, gmn734,

    you have dimmed wbTarget as Workbook so you may only assign a workbook to that variable, not a workseet as well:
    Please Login or Register  to view this content.
    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

+ 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. Simple Open Workbook, Copy Sheet, Paste In New Workbook Question
    By alulla in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-19-2013, 02:10 PM
  2. Replies: 0
    Last Post: 05-08-2013, 02:47 PM
  3. Open workbook, filter values, copy/paste into Active workbook.
    By niceguy21 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-10-2013, 12:17 PM
  4. Replies: 2
    Last Post: 09-11-2012, 09:42 AM
  5. Simple task: Open a workbook, copy a range, paste into another workbook
    By fbonetti in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-21-2011, 01:12 PM

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