Clear cell contents based on cell color

  • I want to clear the contents of cells with no color. When I run the following code, I get "Cannot change part of a merged cell." error. Any suggestion would be greatly appreciated. Thank you.


    [VB]
    Dim c As Range
    For Each c In ActiveSheet.UsedRange
    If c.Interior.ColorIndex = xlNone Then c.ClearContents
    Next c
    [/VB]

    You can say "THANK YOU" for help received by clicking the :thumbup: icon in the bottom right corner of the helper's post.
    Practice makes perfect. I am very far from perfect so I'm still practising.

  • Re: Clear cell contents based on cell color


    It worked like a charm. Thank you so much jindon. You were a great help as always.

    You can say "THANK YOU" for help received by clicking the :thumbup: icon in the bottom right corner of the helper's post.
    Practice makes perfect. I am very far from perfect so I'm still practising.