Copy rows based on cell value

  • Hi,


    I have a big list in sheet "2017" that starts in cell A7 and goes down to about BG3500. In column BP I have a check that checks two criteras and returns "Yes" or "no".
    If there is "No" in column BP on a row, I want the whole row to be copied in to a sheet called "Errors" and it should be placed in cell B7 and onwards. For all rows that contains "no" in column BP, the value in column BS should be copied into column A for the corresponding row in the sheet called "Errors".
    Finally, every time I run the macro, I want all rows from 7 and downwards in the sheet "Errors" to be emptied.


    For example:


    Sheet "2017"
    [TABLE="width: 500"]

    [tr]


    [td]

    Row/Column

    [/td]


    [td]

    A

    [/td]


    [td]

    B

    [/td]


    [td]

    C

    [/td]


    [td]

    D

    [/td]


    [td]

    ..

    [/td]


    [td]

    BP

    [/td]


    [td]

    ..

    [/td]


    [td]

    BS

    [/td]


    [/tr]


    [tr]


    [td]

    7

    [/td]


    [td]

    Sweden

    [/td]


    [td]

    Denmark

    [/td]


    [td]

    aa

    [/td]


    [td]

    aa

    [/td]


    [td][/td]


    [td]

    Yes

    [/td]


    [td][/td]


    [td][/td]


    [/tr]


    [tr]


    [td]

    8

    [/td]


    [td]

    Norway

    [/td]


    [td]

    Denmark

    [/td]


    [td]

    xx

    [/td]


    [td]

    xx

    [/td]


    [td][/td]


    [td]

    No

    [/td]


    [td][/td]


    [td]

    Bad

    [/td]


    [/tr]


    [tr]


    [td]

    9

    [/td]


    [td]

    Finland

    [/td]


    [td]

    Norway

    [/td]


    [td]

    yy

    [/td]


    [td]

    yy

    [/td]


    [td][/td]


    [td]

    No

    [/td]


    [td][/td]


    [td]

    Strange

    [/td]


    [/tr]


    [/TABLE]


    Should be in Sheet "Errors":
    [TABLE="width: 500"]

    [tr]


    [td]

    Row/Column

    [/td]


    [td]

    A

    [/td]


    [td]

    B

    [/td]


    [td]

    C

    [/td]


    [td]

    D

    [/td]


    [td]

    E

    [/td]


    [/tr]


    [tr]


    [td]

    7

    [/td]


    [td]

    Bad

    [/td]


    [td]

    Norway

    [/td]


    [td]

    Denmark

    [/td]


    [td]

    xx

    [/td]


    [td]

    xx

    [/td]


    [/tr]


    [tr]


    [td]

    8

    [/td]


    [td]

    Strange

    [/td]


    [td]

    Finland

    [/td]


    [td]

    Norway

    [/td]


    [td]

    yy

    [/td]


    [td]

    yy

    [/td]


    [/tr]


    [/TABLE]



    And everytime I run the Macro, all things from Row 7 downwards should be emptied first, then copy in all rows that contain "no" in BP
    edit: The rows that are copied from "2017" should NOT be removed from that sheet, only copied


    Thanks a lot in advance

  • Re: Copy rows based on cell value


    Hi Snajder,


    Try this:



    Regards,


    Robert

Participate now!

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