title: Excel VBA Error 1004 - Application-defined or object-defined error with double quotes in my formula
body: <p>I'm trying to add a formula using VBA to a cell in Excel, the (simplified) code is as </p>
  
  <pre><code>    Dim destRow as integer
      destRow = 107
      Cells(destRow, 19) = "=IF(L" &amp; destRow &amp; "="""";"""";""UNB"")"
  </code></pre>
  
  <p>`I've also tried the following (in place of the last line):</p>
  
  <pre><code>    Cells(destRow, 19) = "=IF(L" &amp; destRow &amp; "=" &amp; chr(34) &amp; chr(34) &amp; ";" &amp; chr(34) &amp; chr(34) &amp; ";" &amp; chr(34) &amp; "UNB" &amp; chr(34) &amp; ")"
  </code></pre>
  
  <p>In the immediate window, both produce the correct output:</p>
  
  <pre><code>    =IF(L107="";"";"UNB")
  </code></pre>
  
  <p>...however, I get error 1004 "Application-defined or object-defined error" on the last line when I run my code.</p>
  
  <p>Any help would be appreciated!</p>