+ Reply to Thread
Results 1 to 6 of 6

Opening new workbook and pasting values into current workbook - code issues

  1. #1
    Registered User
    Join Date
    03-28-2014
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    13

    Opening new workbook and pasting values into current workbook - code issues

    Hi all,

    I am using the below code (i have combined different bits of code which i found on these forums) to open a new workbook, copy all the data in it and paste it into Sheet2 in the active workbook . Also, i want the data to be pasted on the next empty row as there is already data in Sheet2. The data that is being copied and pasted has the same format and it is going to be repeated many times.

    The problem i am having is that it is not offsetting the data to the next empty row - i think it is a simple change but i can't seem to get there :s

    Also, the code is currently selecting all of the data from the workbook that i open - is there a way i can select all of the data, excluding the first row (the first row contains the headings which i already have in Sheet2 in the active workbook).

    Thanks in advance!


    Stew

    Please Login or Register  to view this content.
    Last edited by Leith Ross; 05-13-2014 at 01:07 PM. Reason: Added Code Tags

  2. #2
    Registered User
    Join Date
    06-06-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    51

    Re: Opening new workbook and pasting values into current workbook - code issues

    Hi Stew,

    Could it be that

    Please Login or Register  to view this content.
    should be

    Please Login or Register  to view this content.
    ?

  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: Opening new workbook and pasting values into current workbook - code issues

    Hello Stew1234,

    The code should work now.
    Please Login or Register  to view this content.
    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
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Opening new workbook and pasting values into current workbook - code issues

    Try this.
    Please Login or Register  to view this content.
    If posting code please use code tags, see here.

  5. #5
    Registered User
    Join Date
    03-28-2014
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    13

    Re: Opening new workbook and pasting values into current workbook - code issues

    Thanks for the quick response everyone - Norie your change seemed to do the trick.

    As always, really appreciate everyone's help!

  6. #6
    Registered User
    Join Date
    01-30-2013
    Location
    India
    MS-Off Ver
    2013
    Posts
    56

    Re: Opening new workbook and pasting values into current workbook - code issues

    Nice work Norie.. Above code is almost perfect for me, but would you be able to make this code run for data based on the headers? I have a spreadsheet which have headers from Col A to AM and I want paste data from only few columns to my main sheet. Please note data is to be pasted on the next empty row.

    Data should be pasted from test sheet to the master sheet in next empty row but as per the column headers. Sequence of the headers may not be same every time.
    Attached Files Attached Files

+ 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. Replies: 3
    Last Post: 08-20-2013, 02:46 PM
  2. Replies: 1
    Last Post: 06-04-2013, 02:06 AM
  3. Problems opening one workbook, copying and then pasting into the first
    By jortarr in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-02-2010, 04:33 AM
  4. Place code from current workbook to new workbook
    By Qaspec in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-08-2005, 11:05 AM
  5. SELECTING CURRENT DATE BY OPENING WORKBOOK
    By R VAN DEURSEN in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-03-2005, 09:18 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