+ Reply to Thread
Results 1 to 10 of 10

Copy and Paste from another Excel file

  1. #1
    Forum Contributor
    Join Date
    04-23-2013
    Location
    India
    MS-Off Ver
    Excel 2003 and 2007
    Posts
    227

    Copy and Paste from another Excel file

    Good day!,

    I have two speadsheets, Source and Test1 file.


    In Sourcefile, in 'Open Test1 and hold it' CommandButton, i just want to browse the Test1 file and be visible it' path in the textbox.
    In the 2nd Commandbutton (still in source file), i just want to copy All the data except for the heading will be pasted to Test1 file. If the last row in Column 'A' in Test1 file was 'WK1' then the next will be 'WK1' and so forth.

    I've attached the files.
    Thanks in advance!
    Attached Files Attached Files
    Last edited by siobeh; 08-14-2013 at 01:48 PM.

  2. #2
    Valued Forum Contributor
    Join Date
    02-08-2012
    Location
    Newcastle, Australia
    MS-Off Ver
    Excel 2007 and Excel 2010
    Posts
    1,429

    Re: Copy and Paste from another Excel file

    Hi,

    A try these files and see if this is what you're after. If not, let me know and I can change what you need.

    A couple of things to note:
    1. I have assumed the path will not contain the file name "Test1.xlsx", nor will it include the "\" at the end of the path. If this is incorrect, let me know or feel free to change the code yourself if you are handy with VBA.
    2. This assumes that once the data is copied to the source workbook, that you are finished with the test workbook, and Test1.xlsx is closed. Again, if this is incorrect, let me know or change it yourself.

    Hope this helps
    Attached Files Attached Files

  3. #3
    Forum Contributor
    Join Date
    04-23-2013
    Location
    India
    MS-Off Ver
    Excel 2003 and 2007
    Posts
    227

    Re: Copy and Paste from another Excel file

    Hi Aj, thanks for reply, I've tried the files that you've provided and there need somes modifications here:
    1. When i click 'Open Test1 and Hold It', the user will browse where Test1.xlsx is and once the user have browsed the Test1.xlsx, it's path will be visible in the textbox. like: C:\My Documents\Test1.xlsx

  4. #4
    Valued Forum Contributor
    Join Date
    02-08-2012
    Location
    Newcastle, Australia
    MS-Off Ver
    Excel 2007 and Excel 2010
    Posts
    1,429

    Re: Copy and Paste from another Excel file

    No worries. Sorry about the misunderstanding

    Try these attached files. Hope it's right this time.

    Let me know
    Attached Files Attached Files

  5. #5
    Forum Contributor
    Join Date
    04-23-2013
    Location
    India
    MS-Off Ver
    Excel 2003 and 2007
    Posts
    227

    Re: Copy and Paste from another Excel file

    Thanks AJ! the Commandbutton1 has now been worked!, Now, Commandbutton2 should be:

    1.) Open the Excel file that has been browsed (Test1.xlsx)
    2.) Copy the All the data of 'Source file' and add it in the last row of 'Test1.xlsx'
    3.) If last row of Column 'A' was 'W1', then, next will be 'W2'. I've attached the final Output for your reference.
    Attached Files Attached Files

  6. #6
    Valued Forum Contributor
    Join Date
    02-08-2012
    Location
    Newcastle, Australia
    MS-Off Ver
    Excel 2007 and Excel 2010
    Posts
    1,429

    Re: Copy and Paste from another Excel file

    Hi,

    Try this now...
    Attached Files Attached Files

  7. #7
    Forum Contributor
    Join Date
    04-23-2013
    Location
    India
    MS-Off Ver
    Excel 2003 and 2007
    Posts
    227

    Re: Copy and Paste from another Excel file

    Youre a genius!! It works!, BTW, why is that the filename of the output file is in 'Binary'?

  8. #8
    Valued Forum Contributor
    Join Date
    02-08-2012
    Location
    Newcastle, Australia
    MS-Off Ver
    Excel 2007 and Excel 2010
    Posts
    1,429

    Re: Copy and Paste from another Excel file

    I'm not sure what you mean by the output file being in binary...can you please explain that a little further for me, perhaps with a screenshot if necessary?

    You're very welcome. Please don't forget to mark this thread as solved and click on the star to leave me some positive reputation

  9. #9
    Valued Forum Contributor
    Join Date
    02-08-2012
    Location
    Newcastle, Australia
    MS-Off Ver
    Excel 2007 and Excel 2010
    Posts
    1,429

    Re: Copy and Paste from another Excel file

    Ah what a silly mistake. Here, try this one.

    Also, please don't forget to mark this thread as solved and add some reputation to my post to say thanks
    Attached Files Attached Files

  10. #10
    Forum Contributor
    Join Date
    04-23-2013
    Location
    India
    MS-Off Ver
    Excel 2003 and 2007
    Posts
    227

    Re: Copy and Paste from another Excel file

    Perfect!!! :D thank you so much Aj!!!!

+ 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 data from other excel file and paste it to other excel file
    By puuts in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-12-2013, 02:54 PM
  2. Replies: 1
    Last Post: 10-01-2012, 11:11 PM
  3. macro to open, copy paste from existing excel file to a new blank file
    By 2blessed in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-15-2012, 06:05 PM
  4. Replies: 1
    Last Post: 10-17-2005, 04:05 AM
  5. Replies: 1
    Last Post: 01-04-2005, 06:06 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