How to find the days difference between two dates [closed]

Instead of using vba just enter the formula for the first row on C1 :

=ROUND(a1,0)-ROUND(b1,0)

Then just the formula to the end of exisiting rows.

If you insist using vba code use the simple code below:

   Dim LastRow As Long
LastRow = ActiveSheet.Range("A" & Rows.Count).End(xlUp).Row

    Range("c1").Select
    ActiveCell.FormulaR1C1 = "=ROUND(RC[-1],0)-ROUND(RC[-2],0)"
    Range("c1").AutoFill Destination:=Range("C1:C" & LastRow)
End Sub

Browse More Popular Posts

Leave a Comment