title: Formula to include range.address only if it has been set
body: <p>I am using a macro to write a formula into a cell on my Excel worksheet.  The formula is written into the cell using the following code, where xWF1 through wWF5 are all single-cell ranges.</p>
  <pre><code>xWF1.Formula = &quot;=&quot; &amp; xWF2.Address(True,True) &amp; &quot;-&quot; &amp; xWF3.Address(True,True) &amp; &quot;-&quot; &amp; xWF4.Address(True,True) &amp; &quot;-&quot; &amp; xWF5.Address(True,True)
  </code></pre>
  <p>xWF2 through xWF5 are set earlier in the code, if they exist.  When one of them doesn't exist, the line of code above errors.</p>
  <p>What I would like, is for the code to write the formula to include only those ranges that exist.  For example, if xWF4 doesn't exist, the formula would be xWF2-xWF3-xWF5</p>
  <p>What would be a better way to write this code?</p>