Hi Guys -
I am currently working on a small project , currently using two dates to be entered by user and wants the date difference to in "months".
However i am getting the output in "days" not able to figure out the VBA code to handle output in months.
My VBA Code -
Please correct my VBA code.
Thanks in advance
Warm Regards
Relphelp
I am currently working on a small project , currently using two dates to be entered by user and wants the date difference to in "months".
However i am getting the output in "days" not able to figure out the VBA code to handle output in months.
My VBA Code -
Code:
Sub test()
Dim DateStr1 As String
Dim DateStr2 As String
Dim DateDiffStr As String
Dim Date1 As Date
Dim Date2 As Date
Dim DateDiff As Integer
Dim NumberDays As Integer
DateStr1 = InputBox("Enter First Date : ")
Date1 = DateValue(DateStr1)
DateStr2 = InputBox("Enter Second Date : ")
Date2 = DateValue(DateStr2)
temp = Date2 - Date1
NumberDays = Int(temp)
MsgBox ("Number of Days : " & temp)
End Sub
Please correct my VBA code.
Thanks in advance
Warm Regards
Relphelp