title: Excel (2007) VBA - .Formula with quotes in it
body: <p>I tried putting the following code into a program yesterday.  VBA called an error.  I assume it is because of the double quotes inside the formula.  I googled and all results I found just gave the basic of putting formulas in, but none explained how to get around quotes inside.</p>
  
  <p>(there was a With statement before this, Pivot is a worksheet name)</p>
  
  <pre><code>.Range("A2").Formula = "=IF(Pivot!A5="",A1,Pivot!A5)" 
  </code></pre>
  
  <p>Any help is much appreciated.  Thanks!</p>