+ Reply to Thread
Results 1 to 18 of 18

Copy row, find in another worbook and paste

  1. #1
    Registered User
    Join Date
    09-08-2014
    Location
    Czech republic
    MS-Off Ver
    Excel 2007
    Posts
    19

    Copy row, find in another worbook and paste

    Hello Everyone,

    Please apologise me for my English in advance, cause it is not my native speech.

    I am new here and also a beginner in VBA, so I would like to ask for help.

    I am trying to solve a problem to copy exact data in row to another existing workbook. (database)

    Lets say column A1 in workbook1 includes the same word as workbook database in (A:A).

    I need to find in database this word, and copy the selection from workbook1 (B1:H1) at the same row as this word.

    Another issue is I need to paste not in the first free cell, but it have to start copy from column E.

    If my explanation is not understandable, please ask or I can create a sample in excel.

    Many thanks for any reply.

  2. #2
    Registered User
    Join Date
    09-08-2014
    Location
    Czech republic
    MS-Off Ver
    Excel 2007
    Posts
    19

    Re: Copy row, find in another worbook and paste

    Please Login or Register  to view this content.
    I have no idea how to setup to find the the word in one workbook and paste the selection at the row that includes in first column same word.

    Any idea?

  3. #3
    Registered User
    Join Date
    01-20-2014
    Location
    UK
    MS-Off Ver
    Excel 2010
    Posts
    52

    Re: Copy row, find in another worbook and paste

    If you post an example workbook, it will be much easier to help you.
    +++ If I helped please add reputation +++

  4. #4
    Registered User
    Join Date
    09-08-2014
    Location
    Czech republic
    MS-Off Ver
    Excel 2007
    Posts
    19

    Re: Copy row, find in another worbook and paste

    May I need any special right to post the attachement? Or could you advise me how to proceed?

  5. #5
    Registered User
    Join Date
    01-20-2014
    Location
    UK
    MS-Off Ver
    Excel 2010
    Posts
    52

    Re: Copy row, find in another worbook and paste

    To attach a file, push the button with the paperclip (or scroll down to the Manage Attachments button), browse to the required file, and then push the Upload button.

  6. #6
    Registered User
    Join Date
    09-08-2014
    Location
    Czech republic
    MS-Off Ver
    Excel 2007
    Posts
    19

    Re: Copy row, find in another worbook and paste

    Thank you.

    I will have many workbooks like source1, source2....

    The layout will be same everytime, but with different values and with different name in A column.

    I need a button that find the workbook database (N:\database.xlsx) find the same inquiry nr. in column A and paste the raw in appropriate place.

    That means, my inquiry nr is FLSAU779 in A2 source1. That macro have to find the FLSAU779 in database (4th raw) and paste.

    I hope that the attachement help to understand my issue.
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    01-20-2014
    Location
    UK
    MS-Off Ver
    Excel 2010
    Posts
    52

    Re: Copy row, find in another worbook and paste

    In your source workbooks open a new module and paste the following code

    Please Login or Register  to view this content.
    Keep in mind this assumes you are only using the first worksheet in 'source', and that every inquiry number is unique.

    HTH

  8. #8
    Registered User
    Join Date
    09-08-2014
    Location
    Czech republic
    MS-Off Ver
    Excel 2007
    Posts
    19

    Re: Copy row, find in another worbook and paste

    Awesome, that works! But do you think, there is possibility to copy, if the database workbook is not open?

  9. #9
    Registered User
    Join Date
    01-20-2014
    Location
    UK
    MS-Off Ver
    Excel 2010
    Posts
    52

    Re: Copy row, find in another worbook and paste

    You cannot copy from a closed workbook, but you can add a line to open the workbook in your VBA. Something like:
    Please Login or Register  to view this content.

  10. #10
    Registered User
    Join Date
    01-20-2014
    Location
    UK
    MS-Off Ver
    Excel 2010
    Posts
    52

    Re: Copy row, find in another worbook and paste

    Infish,

    If I have answered your question please mark the thread as solved, and if I helped please be kind and add reputation in the bottom left of my post

  11. #11
    Registered User
    Join Date
    09-08-2014
    Location
    Czech republic
    MS-Off Ver
    Excel 2007
    Posts
    19

    Re: Copy row, find in another worbook and paste

    No problem, I will do anything you want if you could help me with last question.

    I use everyday the clasic formula, but in VBA I am still noob

    What if I little change the layout at database? There will be written minimum 4 columns (see attached file). So the copied text will be inserted to the 5th column (DATE).

    Do you think you can change the VBA code for this? And if is possible leave me in VBA note thich values are changeble for this.

    An also please implement the code to open database, insert text, save and close the datase. If it is too complicated, implement only open database.

    Once again thank you very much!
    Attached Files Attached Files

  12. #12
    Registered User
    Join Date
    01-20-2014
    Location
    UK
    MS-Off Ver
    Excel 2010
    Posts
    52

    Re: Copy row, find in another worbook and paste

    To insert in 5th column:

    Please Login or Register  to view this content.
    I have literally given you the code above to open the database, I'm sure you can figure out how to copy and paste.....

    As for the rest, google what you're looking for and try it for yourself.

    Edit: If you still can't figure it out, come back and show us your attempt. We aren't here to do your work for you, we like to see that you have tried to do it yourself first.
    Last edited by cs454; 09-10-2014 at 07:07 AM.

  13. #13
    Registered User
    Join Date
    09-08-2014
    Location
    Czech republic
    MS-Off Ver
    Excel 2007
    Posts
    19

    Re: Copy row, find in another worbook and paste

    You are right. I told you I am a beginner in VBA, but I will try to understand the code and implement the changes.

    Give me the time and I will show you the result.

  14. #14
    Registered User
    Join Date
    01-20-2014
    Location
    UK
    MS-Off Ver
    Excel 2010
    Posts
    52

    Re: Copy row, find in another worbook and paste

    Quote Originally Posted by Infish View Post
    You are right. I told you I am a beginner in VBA, but I will try to understand the code and implement the changes.

    Give me the time and I will show you the result.
    Great, even if you can't get it working show us your work and we will help

  15. #15
    Registered User
    Join Date
    09-08-2014
    Location
    Czech republic
    MS-Off Ver
    Excel 2007
    Posts
    19

    Re: Copy row, find in another worbook and paste

    Seems that works It was't so hard to understand.

    Please Login or Register  to view this content.

  16. #16
    Registered User
    Join Date
    01-20-2014
    Location
    UK
    MS-Off Ver
    Excel 2010
    Posts
    52

    Re: Copy row, find in another worbook and paste

    That's great! And now you have learned to do it yourself

    Please mark the thread as solved if you are done!

  17. #17
    Registered User
    Join Date
    09-08-2014
    Location
    Czech republic
    MS-Off Ver
    Excel 2007
    Posts
    19

    Re: Copy row, find in another worbook and paste

    I am finally done. Thank you very much for your efforts and patience with me. I am little bit smarter in VBA now

  18. #18
    Registered User
    Join Date
    01-20-2014
    Location
    UK
    MS-Off Ver
    Excel 2010
    Posts
    52

    Re: Copy row, find in another worbook and paste

    Quote Originally Posted by Infish View Post
    I am finally done. Thank you very much for your efforts and patience with me. I am little bit smarter in VBA now
    No problem

+ 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: 2
    Last Post: 08-31-2014, 09:59 AM
  2. Macro to copy and paste values from diff sheets into a template worbook
    By bloom1439 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-24-2013, 10:25 AM
  3. [SOLVED] Macro to Find, copy, paste, find, copy, paste, find, copy, paste, u get the picture....
    By westsoldman in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 11-12-2012, 01:12 AM
  4. Copy paste from one worbook to another workbook
    By mmf in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-04-2008, 01:00 PM
  5. Copy paste from one worbook to another workbook
    By chrisrasburn in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-20-2008, 07:29 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