title: Excel VBA Substract two dates to count days in entire columns
body: <p>I am trying without a positive result a function that calculates difference in days between days in Column &quot;B&quot;, B2:B range and today date that is in cell &quot;K2&quot; and results are being transferred into in column 7, range: G2:G.
  So far I am getting more and more excited about VBA coding, but as a person that needs more exp in this I would like to ask for some help about solving this issue.</p>
  <pre><code>Sub DateSub()
      Dim strInput As String, strOutput As String
      Dim start_date As Date
      Dim end_date As Date
      Dim diff As Integer
      
     Dim LastRowcheck As Long, n1 As Long
      Sheets(&quot;T1&quot;).Range(&quot;K2&quot;) = Format(Date, &quot;DD-MM-YY&quot;) 'today
      end_date = Sheets(&quot;T1&quot;).Cells(2, 11).Value
      LastRowcheck = Sheets(&quot;T1&quot;).Range(&quot;B&quot; &amp; Rows.Count).End(xlUp).Row
  
    For n1 = 1 To LastRowcheck
      With Worksheets(&quot;T1&quot;).Cells(n1, 2)
          start_date = Sheets(&quot;T1&quot;).Cells(n1, 2).Value
          diff = DateDiff(&quot;D&quot;, start_date, end_date) ' HERE IS ISSUE
          Cells(nl + 1, 2) = diff
          Sheets(&quot;T1&quot;).Cells(n1 + 1, 7).Select
          Selection.NumberFormat = &quot;dd-mm-yy&quot;
          
     End With
    Next n1
      Application.DisplayAlerts = False
  
  End Sub
  </code></pre>