title: Getting run-time error 1004 while trying to calculate using formula
body: <p>I'm getting a run-time error while trying to calculate a common excel formula in VBA.
  Here's the part of the code that seems to have problems:</p>
  
  <pre><code>   With ActiveSheet
      LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
     .Range("F4").Formula = "=IF(AND(C5=0;D5=0;E5=0);B5;IF(AND(C5=0;OR(D5&lt;&gt;0;E5&lt;&gt;0));B5;0))"
     .Range("F4").Copy
      With .Range("F5:F" &amp; LastRow)
              .PasteSpecial Paste:=8
              .PasteSpecial Paste:=xlPasteFormulas
              .PasteSpecial Paste:=xlPasteFormats
      End With
  End With
  </code></pre>
  
  <p>I'think there's simply something wrong in writing the formula using the correct VBA syntax, since if i just substitute with "=2+2" it works.</p>