+ Reply to Thread
Results 1 to 6 of 6

VBA code to copy data from one workbook to another workbook if one criteria is met.

  1. #1
    Registered User
    Join Date
    01-20-2013
    Location
    Iowa,USA
    MS-Off Ver
    Excel 2007
    Posts
    3

    VBA code to copy data from one workbook to another workbook if one criteria is met.

    I would greatly appreciate help writing code on how to transfer data from one workbook to another workbook with the use of a command button in the sending workbook. In my sending workbook(1026Log), if column P has a Yes in the column, then I would like only the data in columns A to H to be sent to the receiving workbook(WetlandLog) with a command button that says something like Send Data. (Data in the remaining columns would not be transferred). If column P is empty or says no, then no data would be transferred to the other workbook. It would need to have a loop in so that as new data is added to each row in the sending workbook, it could be added to the receiving workbook by clicking on the command button. Can anyone help me with this? Thank you so much!

  2. #2
    Valued Forum Contributor
    Join Date
    02-09-2012
    Location
    Mauritius
    MS-Off Ver
    Excel 2007
    Posts
    1,055

    Re: VBA code to copy data from one workbook to another workbook if one criteria is met.

    Hi

    Post sample file please!!!
    Click *, if my suggestion helps you. Have a good day!!

  3. #3
    Registered User
    Join Date
    01-20-2013
    Location
    Iowa,USA
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re:VBA code to copy data from one workbook to another workbook if one criteria is met

    Files attached. I am trying to learn VBA but think was too big a project for me to start on. If I have to, instead of transferring the data to another workbook, transferring the data to another sheet in the same workbook would be okay. But what I am trying to accomplish is that if column p in the 1026 workbook has a yes in it, then all the data in columns a:h would be moved to the wetland workbook. If the cell in column P is blank, then the data is not transferred. Any help would be appreciated very much.
    Attached Files Attached Files

  4. #4
    Valued Forum Contributor
    Join Date
    02-09-2012
    Location
    Mauritius
    MS-Off Ver
    Excel 2007
    Posts
    1,055

    Re: VBA code to copy data from one workbook to another workbook if one criteria is met.

    Hi..

    Check this :

    Test1026Log.xlsm

  5. #5
    Registered User
    Join Date
    01-20-2013
    Location
    Iowa,USA
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: VBA code to copy data from one workbook to another workbook if one criteria is met.

    Thank you! That works! I suppose it's too much to ask, but...when I continued to add data, it copied the data again that had already been sent to the other sheet. Can you tell it not to do that?! Since we will be constantly updating the sheet, I would rather not have the data copied and over again if it has already been copied. If that's not possible, I will try to figure out another way to manage the data. But I so, so appreciate what you did so far! Thank you!

  6. #6
    Valued Forum Contributor
    Join Date
    02-09-2012
    Location
    Mauritius
    MS-Off Ver
    Excel 2007
    Posts
    1,055

    Re: VBA code to copy data from one workbook to another workbook if one criteria is met.

    Hi

    Thanks for your feedback.

    Here's the modified version:

    Test1026Log.xlsm

    If satisfied with this then please click star below. Thanks again

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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