title: Insert formula in one cell using VBA
body: <p>I know this topic was already asked and I tried to copy on how to insert a formula in one cell, however, I got an error in my vba code.</p>
  
  <p><a href="https://i.stack.imgur.com/7uB9E.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/7uB9E.jpg" alt="enter image description here"></a></p>
  
  <p>Here is my code:</p>
  
  <pre><code>ws.Range("C9").Formula = "=CountIf(wsRD.Range(C &amp; Rows.count).End(xlUp).Row, ""Event"")"   'CountIf(wsRD.Range("C" &amp; Rows.count).End(xlUp).Row, "Event") 'count(Search("Event", wsRD.Range("C" &amp; Rows.count).End(xlUp).Row, 1))
  </code></pre>
  
  <p>I need to insert a formula in ws.Range("C9"), in which, it summarizes the count of the cell that have a value of "Event" in wsRD.Range("C" &amp; Rows.count).End(xlUp).Row. May I know what's the problem in my code? Appreciate your help. </p>
  
  <p>Thank you.</p>