title: VBA - Subtracting varying amount of dates
body: <p>I am having trouble figuring out how to subtract the very end date of a contract with the beginning date. However, I cannot figure out how to reference the initial date.<a href="https://i.stack.imgur.com/kgbz1.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/kgbz1.png" alt="Example"></a>.  </p>
  
  <p>For example, <code>=D2 - C2</code> as well as be able to do <code>=D10 - C5</code>.  This is what I currently have, and it does not work at all.  </p>
  
  <pre><code>Dim sla As Long, slacnt As Long, drng As Long, i As Long
  i = 2
  
  With Worksheets("Raw")
      slacnt = .Cells(.rows.Count, 2).End(xlUp).Row
      For sla = i To slacnt
          drng = Sheets("Data").Range("B" &amp; i).Value
          If .Range("B" &amp; i) &lt;&gt; .Range("B" &amp; i).Offset(1, 0) Then
          Else: drng = .Range("D" &amp; i).Value - .Range("C" &amp; i).Value
          End If
      Next sla
  End With
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/sAnW3.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/sAnW3.png" alt="Image 2"></a></p>
  
  <p>Any direction would be greatly appreciated, thanks in advance.</p>