delete row based on color of cell

  • Hi ,
    I was wondering if anybody can give me some code to delete all rows
    in a range when the color of the cell in column H does not equal
    the interior.colorindex 3 (red)


    some issues


    data begins at cell H3
    the red color is given by conditionnal formatting
    the amount of data will grow in the future


    :thanx:

  • Re: delete row based on color of cell


    hi Crombes


    try the code below:


    hope it helps

    Cheers
    ___________
    Xlite :sheep:
    [st]All you need to learn VBA is an internet connection and Ozgrid.com[/st]

  • Re: delete row based on color of cell



    Thanks xlite


    but somehow this didn't work
    I have included my file
    can you have a look?

  • Re: delete row based on color of cell


    Try...

    If I've been helpful, let me know. If I haven't, let me know that too.

  • Re: delete row based on color of cell


    hi crombes,


    dangelor's solution solves yr problem by nicking it on the bud,
    its certainly is more efficient than the big round about solution i'm trying to come out with,
    thanks dangelor :thanx:


    anyway, i believe you need to use the more than function for yr solution

    Code
    1. If c > Date Then

    Cheers
    ___________
    Xlite :sheep:
    [st]All you need to learn VBA is an internet connection and Ozgrid.com[/st]

  • Re: delete row based on color of cell


    Quote from xlite

    hi crombes,


    dangelor's solution solves yr problem by nicking it on the bud,
    its certainly is more efficient than the big round about solution i'm trying to come out with,
    thanks dangelor :thanx:


    anyway, i believe you need to use the more than function for yr solution

    Code
    1. If c > Date Then



    Thanks works like a charm :rock:

  • This is making me bonkers and please forgive my ignorance, I am learning as quickly as I can and I have come a long way. However, I am stuck.


    All I want is a very simple routine and it shouldn't be as complicated as I am making it.


    Active worksheet ("Unique").
    Column B
    Cell 1
    Is the background Red (Conditional formatting "Bad" Red as in 255,199,206)?
    Yes? delete the whole row
    No? Go to the next cell in column B
    When the last populated cell in Column B is considered, Stop


    Some of the code out there is all over the place. Is there an "I'll make it complex to wow and impress the world?" or am I just stuck in a learning curve? Get Buddhist on me, bare bones, minimal.


    Thanks in advance for your help.
    Marc

  • Hello and Welcome to the Forum


    You should have started your own thread ...


    But ... given the fact your Red background color is the result of Conditional Formatting ...


    You should be building your macro around the underlying rule ... i.e the rule you have created for your Conditional Formatting ...


    Hope this will help

    If you feel like saying "Thank You" for the help received, do not hesitate to click the "Like" icon ...just below...in the bottom right corner...:)