title: VBA Excel: Apply conditional formatting to BLANK cells
body: <p>I'm trying to write a sub procedure which applies some conditional formatting to a range of cells in Excel.
  I'm getting a bit stuck so I used the Macro recorder. I can't however figure out why it's applying the formula below and when I run the code manually it fails.</p>
  
  <ul>
  <li>What I want to do is apply conditional formatting to the blank cells in the range.</li>
  <li>I want to make the cell color grey</li>
  <li>The range is a table and the table is called 'Table1'.</li>
  <li>I need to do this in a sub because the table refreshes dynamically.</li>
  </ul>
  
  <p>Below is the recorded macro which doesn't work and instead applies formatting to the wrong cells.
  Any help correcting it would be appreciated</p>
  
  <p>Thanks</p>
  
  <pre><code>Sub MacroTest()
  
      Range("Table1").Select
      'The below formula is wrong but I can't figure out what it should be
      Selection.FormatConditions.Add Type:=xlExpression, Formula1:="=LEN(TRIM(D15))=0"
      With Selection.FormatConditions(1).Interior
          .PatternColorIndex = xlAutomatic
          .ThemeColor = xlThemeColorAccent2
          .TintAndShade = 0.399945066682943
      End With
      Selection.FormatConditions(1).StopIfTrue = False
  
  End Sub
  </code></pre>