Macro to copy data ny if not duplicated

  • Re: Macro to copy data ny if not duplicated


    You do not need the button. Try this in the Worksheet Object module for Sheet 1


    Any entry in column A of sheet 1 will fire the macro. If entry does not exist in data bank, or if entry is a duplication then there will be a message and the entry will be cleared, otherwise data for entered ID will be added, text will be centered and borders added.

    We now have a reputation system in place. If my reply helped please "Like" the reply by clicking the "Like" icon at bottom right of my reply.

  • Re: Macro to copy data ny if not duplicated


    thanks a million master KJBOX


    there is only one thing : i want it to let me enter datas if it not exist in "databank" sheet,only duplications are forbidden

  • Re: Macro to copy data ny if not duplicated


    In that case change the code to this

    We now have a reputation system in place. If my reply helped please "Like" the reply by clicking the "Like" icon at bottom right of my reply.

  • Re: Macro to copy data ny if not duplicated


    OK, I just re-read your opening post, I think I misunderstood.


    Are you wanting to enter data in sheet 2 row 2 and add that data to the data bank sheet as long as the ID does not already exist in the data bank?

    We now have a reputation system in place. If my reply helped please "Like" the reply by clicking the "Like" icon at bottom right of my reply.

  • Re: Macro to copy data ny if not duplicated


    OK. How does Sheet 1 work? Does it get updated with multiple rows of data or one row at a time?


    Does new data on sheet 1 get added to any existing data on that sheet or does new data replace old data?

    We now have a reputation system in place. If my reply helped please "Like" the reply by clicking the "Like" icon at bottom right of my reply.

  • Re: Macro to copy data ny if not duplicated


    i want that when enter data only in range a2 :d2 (sheet 1) , then push a button , this button do this functions:


    if ID is exist in "databank" sheet ( column a ) , Prompt me that it s duplicated , so do nothing in "databank" sheet


    but if the id is not existed in "databank" sheet


    then add new row to existing datas



    and so on ...

  • Re: Macro to copy data ny if not duplicated


    OK so only row 2 of Sheet 1 will contain data at any time?

    We now have a reputation system in place. If my reply helped please "Like" the reply by clicking the "Like" icon at bottom right of my reply.

  • Re: Macro to copy data ny if not duplicated


    yes, but this data will be replace every time, but i want to databank sheet keep previous data constantly

  • Re: Macro to copy data ny if not duplicated


    i find this code


    is it good?


  • Re: Macro to copy data ny if not duplicated


    Sorry, I got caught up with a load of other work, I will look at you file and my code again shortly.

    We now have a reputation system in place. If my reply helped please "Like" the reply by clicking the "Like" icon at bottom right of my reply.

  • Re: Macro to copy data ny if not duplicated


    Try the attached, as soon as A2 to D2 has a value entered in each cell then the 4 values will get transferred to the Table on the "data bank" sheet, unless the ID in cell A2 already exists in the data bank.


    Code in the Worksheet Object Module for Sheet1 is

  • Re: Macro to copy data ny if not duplicated


    You're welcome.

    We now have a reputation system in place. If my reply helped please "Like" the reply by clicking the "Like" icon at bottom right of my reply.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!