Compare a row of cells to another worksheet and copy data depending on cell match

Important Notice


Please note that on 14th December 2023 users will experience an expected outage whilst we make upgrades to our network. We anticipate this process may take a couple of hours and so we apologise in advance for any inconvenience.

  • What I'm trying to do is make a script that depending on what button pressed will compare a row on two sheets (For example rocketOld and rocketNew) then depending on if it finds a match will copy data from rocketOld to rocketNew from one cell to the right of the compared row to the right side of the row that was matched.


    I've tried googling around to find a script similar that I can adapt but no luck.

  • Re: Compare a row of cells to another worksheet and copy data depending on cell match


    Can you upload a sample book please?


    Cheers

    [SIZE=3]The Only Dumb Question Is A Question Not Asked.[/SIZE]

  • Re: Compare a row of cells to another worksheet and copy data depending on cell match


    I will have a look and return later :)

    [SIZE=3]The Only Dumb Question Is A Question Not Asked.[/SIZE]

  • Re: Compare a row of cells to another worksheet and copy data depending on cell match


    Can you clarify your request a bit? Does the entire row have to match?

    [SIZE=3]The Only Dumb Question Is A Question Not Asked.[/SIZE]

  • Re: Compare a row of cells to another worksheet and copy data depending on cell match


    No the entire row doesn't need to match, just the serial number.


    So what is supposed to happen is if a serial number on rocketNew matches a serial number on rocketOld copy the CEMS ID over to rocketNew.


    Edit: I phrased that wrong, it should only be checking the serial numbers, even if there is data that is the same in the row, I only want it to check serial numbers because the other data will change.


    Edit2: So I've kinda adapted this script to highlight what it finds as matches from rocketOld to rocketNew possible to adapt this to look once cell over from the matches and paste the CEMS ID to rocketNew instead of highlighting?


  • Re: Compare a row of cells to another worksheet and copy data depending on cell match


    Modified my code a little, it's actually not working gives an error of:
    Run-time error '1004':


    Method 'Range' of object '_Global' failed


    Code is now:

  • Re: Compare a row of cells to another worksheet and copy data depending on cell match


    Actually solved this, sorry for not editing, will post final code tomorrow.

  • Re: Compare a row of cells to another worksheet and copy data depending on cell match


Participate now!

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