title: How to create a counter in Excel online (Excel 365)
body: <p>I know to use Active X and buttons to create a counter that when clicked increments by 1 in normal Excel easily enough but excel 365(online) doesn't allow for buttons. Any idea how to create a counter in Excel online?</p>
  <p>So I found this bit of code but I don't know Javascript. Anybody know enough that can be of help?</p>
  <pre><code>Public xRgS, xRgD As Range
  Public xNum As Long
  Private Sub Worksheet_SelectionChange(ByVal Target As Range)
      On Error Resume Next
      If Target.Cells.Count &gt; 1 Then Exit Sub
      Set xRgS = Range(&quot;E2&quot;)
      If xRgS Is Nothing Then Exit Sub
      Set xRgD = Range(&quot;H2&quot;)
      If xRgD Is Nothing Then Exit Sub
      If Intersect(xRgS, Target) Is Nothing Then Exit Sub
      xNum = xNum + 1
      xRgD.Value = xNum
  End Sub
  </code></pre>
  <p>It just keeps track of everytime you click inside a cell.</p>