Datediff Function
Private Sub CommandButton1_Click()
Range("A1").Value = DateDiff("d", "1-jan-2015", "1-March-2015")
MsgBox DateDiff("d", "1-jan-2015", "1-March-2015")
Range("A2").Value = Date
Range("B2").Value = "1-Oct-2016"
Range("C2").Value = DateDiff("d", Range("A2"), Range("B2"))
Range("d2").Value = DateDiff("ww", Range("A2"), Range("B2"))
Range("E2").Value = DateDiff("h", Range("A2"), Range("B2"))
Range("F2").Value = DateDiff("s", Range("A2"), Range("B2"))
Range("G2").Value = DateDiff("m", Range("A2"), Range("B2"))
End Sub