+ Reply to Thread
Results 1 to 11 of 11

macro to copy and paste only if not duplicating in destination and then copy if empty

  1. #1
    Forum Contributor
    Join Date
    07-07-2019
    Location
    london
    MS-Off Ver
    2013
    Posts
    105

    macro to copy and paste only if not duplicating in destination and then copy if empty

    Hi ALL,

    i would be so very grateful if you could assist me with matching my book to other data.

    i have had to take a sample of other data for security reasons, however the object of what i am doing to to get my "ammend" data to match some data elsewhere
    unfortunately i cant use the handy query data clean ups because the destination data is also very unique ( not clean )

    the only thing i can see to do is create my own id of names (i have them in ammend)

    however , for the attached workbook, what i am actually asking is:

    Is it possible to be able to copy data (NAMES ((COL E)) ) and PASTE to a column (H) ONLY the names that are NOT already in the paste destination column. (also being H) ( so paste new records ONLY )

    in terms of my spreadsheet

    I Need to COPY all the names in COL E (not the header though)
    and paste it to COL H (name)
    However i only want pasted any names that ARE NOT ALREADY here in COL H ( so in actual terms that would be the names = t fold, d menance, c world and g fell ONLY but not the others )

    and then

    Can I have, in the AMMEND (I), column a formulae or something
    that says IF this column (ammend) is EMPTY, then it will copy the contents of Column H (name) = ( so it would only copy the NEW records )

    I would like to then run the whole process by creating a MACRO ( That runs the question 1 (copy and paste new records) , and then runs the question 2 (copy if empty)

    is this possible ? dont worry about the macro part if that is not possible

    your help is so much appreciated as this has stumbled me for a few days and now im just going round in circles

    if i havent been clear or you have any questions then please do ask me, thanks very much, its very appreciated, sa
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,066

    Re: macro to copy and paste only if not duplicating in destination and then copy if empty

    Is it what you need ?
    Please Login or Register  to view this content.
    - Battle without fear gives no glory - Just try

  3. #3
    Forum Contributor
    Join Date
    07-07-2019
    Location
    london
    MS-Off Ver
    2013
    Posts
    105

    Re: macro to copy and paste only if not duplicating in destination and then copy if empty

    spot on PCI it works !!, thanks very much.

    although i am still missing a solution to the 2nd part, which is
    "Can I have, in the AMMEND (I), column a formulae or something
    that says IF this column (ammend) is EMPTY, then it will copy the contents of Column H (name) = ( so it would only copy the NEW records )"

    i think i have worded this awkwardly though, what i am asking is

    can i now ,magically somehow, COPY Column H9 (excluding the header) and paste it to I9. BUT .... ONLY PASTE IT IF the cell in I9 is empty.

    i am having the most problems with this one, something about cells referencing themselves.

    is that possible, if so, big thumbs up if could show me how.

    then i assume i can just add the two macros together. thanks steve

  4. #4
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,066

    Re: macro to copy and paste only if not duplicating in destination and then copy if empty

    The story of column AMMEND is included in the macro.
    If there is no data in AMMEND column then values from column "H" will be pasted.
    If it is not correct then give example of what you want

  5. #5
    Forum Contributor
    Join Date
    07-07-2019
    Location
    london
    MS-Off Ver
    2013
    Posts
    105

    Re: macro to copy and paste only if not duplicating in destination and then copy if empty

    ok PCI. I see what you mean, and yes what you have done works but i
    perhaps wasnt too clear on what i wanted. basically for it to be split into two different macros.

    the first one works perfectly.
    first one is
    COPY NAME (E) to PASTE to NAME (H) but only for new names that are not already in H.
    This works. but should be nothing connected to the ammend col at this stage.

    After this is done.

    is it possible to COPY col H (excluding header) and PASTE to col I BUT paste it ONLY if the cell it is pasting to is empty
    so in my example it would copy ALL column h but would only in fact paste to I 7 to I 11, as they are empty

    i am thinking , in theory, this would be much harder to do.

    pls let me know if this is poss when u can, many many thanks, steve

  6. #6
    Forum Contributor
    Join Date
    07-07-2019
    Location
    london
    MS-Off Ver
    2013
    Posts
    105

    Re: macro to copy and paste only if not duplicating in destination and then copy if empty

    so its the second thing i am stuck on. the bit after i say "after this is done"

  7. #7
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,066

    Re: macro to copy and paste only if not duplicating in destination and then copy if empty

    Which values from column "H" will be pasted to column "I"

  8. #8
    Forum Contributor
    Join Date
    07-07-2019
    Location
    london
    MS-Off Ver
    2013
    Posts
    105

    Re: macro to copy and paste only if not duplicating in destination and then copy if empty

    All of the Values in H but only pasted if the ammend cell is EMPTY

    so for example

    you see in I2 the cell HAS the value j l, ill need this left here and not pasted over.
    and the same in cell I3 has the value "grant" i would need this left here and not pasted over
    so anything where the IS a value in column I should not be pasted over

    HOWEVER

    any other cell in COL H that has a BLANK EMPTY cell next to it in COL I then those will need to be pasted over.

    hope this make sense and can be done.

    thanks, sa

  9. #9
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,066

    Re: macro to copy and paste only if not duplicating in destination and then copy if empty

    Is it ...?

    Please Login or Register  to view this content.

  10. #10
    Forum Contributor
    Join Date
    07-07-2019
    Location
    london
    MS-Off Ver
    2013
    Posts
    105

    Re: macro to copy and paste only if not duplicating in destination and then copy if empty

    Yes that works perfectly PCI. thanks very much indeed. your a master !!!

  11. #11
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,066

    Re: macro to copy and paste only if not duplicating in destination and then copy if empty

    You're welcome Steve, and thx for the Rep.
    PCI

+ 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. [SOLVED] Copy / Paste Values to different worksheet using Copy Destination
    By TheRobsterUK in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-04-2021, 10:27 AM
  2. Copy and paste to destination range of cells only if empty
    By RonnG in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-11-2020, 10:35 AM
  3. Copy from static destination & paste to dynamic destination
    By Marbleking in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 12-31-2015, 09:31 AM
  4. Destination cell is empty after copy and paste
    By wingnut74 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-22-2014, 05:56 PM
  5. [SOLVED] Destination copy and paste (values only) for copy loop
    By mr_mango81 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-01-2013, 08:59 PM
  6. Change Paste Destination in a Copy Macro
    By Akira181 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-22-2013, 10:47 AM
  7. Help on copy and paste macro to next empty row
    By sarath25 in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 01-09-2011, 05:26 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