title: Excel formula error on VBA
body: <p>I am trying to put the following code into VBA. What I ideally want is to apply the formula to the column H when column A is empty. Any help would be appreciated. 
  endPosition is a variable which holds the row# value where column A is empty. </p>
  
  <pre><code>ActiveCell.Formula = "=SUM(N(FREQUENCY(R[endPosition]C[-1]:R[endPosition]C[-1],R[endPosition]C[-1]:R[endPosition]C[-1])&gt;0))"
  </code></pre>
  
  <p>This formula is applied at the end when the loop sees a blank cell:</p>
  
  <pre><code>    Range("A1").Select
      beginPosition = 2 'Start from row number 2
      Do While IsEmpty(ActiveCell.Offset(1, 0)) = False
      ActiveCell.Offset(1, 0).Select
      endPosition = ActiveCell.Row
      Loop
      endPosition = endPosition + 1
      Range("H15").Select
      ActiveCell.Formula = "=SUM(N(FREQUENCY(R[endPosition]C[-1]:R[endPosition]C[-1],R[endPosition]C[-1]:R[endPosition]C[-1])&gt;0))"
  </code></pre>