title: How to check if Range.Interior.ColorIndex=xlNone in a simple way?
body: <p>I've tried several ways to check whether any cell within a range is colored and wonder if there is a simpler way to do the same thing.</p>
  
  <p>My 1st try:</p>
  
  <pre><code>If Range("A1:O50").Interior.ColorIndex = xlNone Then MsgBox ("Nothing is colored") Else MsgBox ("Sth is colored")
  </code></pre>
  
  <p>It worked well, though what I really want is to trigger sth when any cell within a range is colored.</p>
  
  <hr>
  
  <p>2nd try:</p>
  
  <pre><code>If Not Range("A1:O50").Interior.ColorIndex = xlNone Then MsgBox ("Sth is colored") Else MsgBox ("Nothing is colored")
  </code></pre>
  
  <p>It didn't work. Seems that VBA don't understand the negation of "Range.Interior.ColorIndex = xlNone".</p>
  
  <p>I know I can do it this way:</p>
  
  <pre><code>If Range("A1:O50").Interior.ColorIndex = xlNone Then Else MsgBox ("Sth is colored")
  </code></pre>
  
  <p>However it's not that intuitive and not easy to use when there are many conditions.</p>
  
  <hr>
  
  <p>3rd try:</p>
  
  <pre><code>If CBool(Range("A1:O50").Interior.ColorIndex = xlNone) = False Then MsgBox ("Sth is colored")
  </code></pre>
  
  <p>This time I tried to convert the ...ColorIndex=xlNone thing to a boolean value, but it returned a "invalid use of null" when any cell was actually colored.</p>
  
  <hr>
  
  <p>4th try:</p>
  
  <pre><code>Dim b As Boolean
  If Range("A1:O50").Interior.ColorIndex = xlNone Then b = True Else b = False
  If b = False Then MsgBox ("Sth is colored")
  </code></pre>
  
  <p>It worked fine, but it's not simple enough for me. I want to do this in 1-2 lines and no use of variable if possible.</p>
  
  <p>Is there any simpler way to do the same task? Any inspiration is appreciated. Thanks a lot!</p>