title: Excel VBA name error when setting cell formula through VBA
body: <p>I'm entering a formula in excel using vba, but I don't get the evaluation in the cell, rather I get a <strong><code>#name</code></strong> error.  </p>
  
  <p>The formula is written correctly, because when I go into the cell and press <strong><code>F2+Enter</code></strong>, I get the value I'm looking for. I've searched for some ways to do this, but I cannot find an answer that solves my issue. </p>
  
  <p>My formula goes like this:</p>
  
  <pre><code>ActiveCell.Formula =  
  "=IF(A3="""","""",VLOOKUP(C3,AsignaciónCurvas!$B$5:$R$76,SI(B3=""MXP"",14,SI(B3=""UDI"",15,SI(B3=""USD"",16,1))),0))"
  </code></pre>
  
  <p>I have tried using <code>ActiveCell.FormulaR1C1</code> or  <code>ActiveCell.value</code> instead of <code>ActiveCell.Formula</code>, but none of them worked. I also found something on the Internet using <code>SendJey</code> command like this code:</p>
  
  <pre><code>Application.SendKeys "{F2}", True
  Application.SendKeys "{ENTER}", True
  </code></pre>
  
  <p>When I did this I got a new "window" opened from the vba application and it didn't work either.</p>