title: Use Function on range
body: <p>Following my previous question:
  <a href="https://stackoverflow.com/questions/36429924/background-color-based-on-difference-with-cell">Background Color based on difference with cell</a>
  . I would now like to apply this function to a range of rows.</p>
  
  <p>The function I'd like to apply is: </p>
  
  <pre><code>If Sheets("X").Range("E18") &gt; Sheets("blocked(R)").Range("D18") Then
      Sheets("X").Range("E18").Interior.ColorIndex = 10
  </code></pre>
  
  <p>The range I need to apply this function to is fixed: <code>D18:E1200</code>.
  However, there will be an active filter on this range.</p>
  
  <p>The <code>Autofill</code> code of course is not working and writing a line of code for each of 1200 rows would be crazy. </p>
  
  <p>I have been searching and reading and I think it must be something like: </p>
  
  <pre><code>Dim rng As Range
  Dim row As Range
  Dim cell As Range
  
  Set rng = Range("A1:C2")
  
  For Each row In rng.Rows
    For Each cell in row.Cells
      'Do Something
    Next cell
  Next row
  </code></pre>
  
  <p>But I don't seem to get it to work, I was hoping for some pointing into the right direction of the community.</p>