title: Numbering every event which was splited from range to separate line
body: <p>I found a VBA code online which does the hardest part of splitting absences data from ranges to separate line for each day. But one thing I cannot figure out how to do it is how to assign a number to each day that was requested. Could anyone help me? For better understanding see screenshot. Greatly appreciated!</p>
  <p><a href="https://i.stack.imgur.com/nW8NB.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/nW8NB.png" alt="enter image description here" /></a></p>
  <p>Yellow and Green coloured lines separates events. Orange is the thing I am trying to accomplish. <a href="https://i.stack.imgur.com/h75qt.png" rel="nofollow noreferrer">Absences</a></p>
  <pre><code>Sub One_Day_Per_Row()
    Dim a, b
    Dim rws As Long, sr As Long, i As Long, j As Long, k As Long, r As Long
    
    a = Range(&quot;A2&quot;, Range(&quot;A&quot; &amp; Rows.Count).End(xlUp)).Resize(, 6).Value
    rws = UBound(a, 1)
    For r = 1 To rws
      a(r, 6) = a(r, 5) - a(r, 4) + 1
      k = k + a(r, 6)
    Next r
    If k &lt; Rows.Count Then
      ReDim b(1 To k, 1 To 4)
      sr = 1
      For r = 1 To rws
        For i = 0 To a(r, 6) - 1
          For j = 1 To 3
            b(sr + i, j) = a(r, j)
          Next j
          b(sr + i, 4) = a(r, 4) + i
        Next i
        sr = sr + a(r, 6)
      Next r
      Range(&quot;G2&quot;).Resize(k, 4).Value = b
      Range(&quot;G1:J1&quot;).Value = Array(&quot;emp number&quot;, &quot;emp name&quot;, &quot;absence code&quot;, &quot;date&quot;)
    Else
      MsgBox &quot;Too many rows&quot;
    End If
  End Sub
  </code></pre>