title: ActiveCell.Formula = Variable Not Working
body: <p>I am trying to fill the active cell with a formula. An example of the desired formula is =SUMIF(K30:K40,DescVar,E30:E40) where DescVar is string variable.</p>
  <p>Here is the snip of code that is giving me problems:</p>
  <pre><code>If Selection.Value &lt;&gt; DescVar Then
  
  Selection.Offset(1, -6).Select
  
  Dim CalcRow As Integer, FromRow As Integer, ToRow As Integer
  CalcRow = ActiveCell.Row
  FromRow = CalcRow + 1
  ToRow = FromRow + 10
  
  Dim SumFormula As String
  SumFormula = &quot;='SUMIF(K&quot; &amp; FromRow &amp; &quot;:K&quot; &amp; ToRow &amp; &quot;,&quot; &amp; DescVar &amp; &quot;,E&quot; &amp; FromRow &amp; &quot;:E&quot; &amp; ToRow &amp; &quot;)&quot;
  
  ActiveCell.Formula = SumFormula
  
  End If
  </code></pre>
  <p>Any ideas?</p>