title: How to count how many times you run a macro
body: <p>I need to <strong>count</strong> everytime I run a macro. Currently, this is what I'm doing:  </p>
  
  <pre><code>Public i As Integer
  
  Sub Macro5()
  
  i = i + 1
  
  Cells(5, 5).Select
  ActiveCell.FormulaR1C1 = "=" &amp; i // printing the i in 5,5 cell
  
  End Sub
  </code></pre>
  
  <p>But everytime I run Macro5 again, the i sets to 1 (0 at first, but adding 1 to it making it 1).<br>
  Any idea how I can count it? Thanks!</p>