I am trying to create a macro that as well as many other things will loop through the dates in column and, compare it to the "due date" and show the amount of dates that is left
Unfortunately the macro that I wrote doesn't give the desired outcome and gives me some huge number instead.
my code for that part so far is:
Sub calcDays()
Dim dueDate As Date
Dim macroLastRow As Long
Dim macroWs As Worksheet
Set macroWs = ThisWorkbook.Worksheets("Macro")
macroLastRow = macroWs.Range("A" & Rows.Count).End(xlUp).Row
dueDate = Range("B1").Value
For i = 2 To macroLastRow
Cells(i, 2).Value = DateDiff("d", i, dueDate)
Next i
End Sub
This is what I get after I run the macro:
I hope that you guys will be able to advise! Thanks a mil in advance!