Private Sub Text21_Enter()
hi, here is some code i wrote, but im having some problems.
this works fine for calculating a diference in years. but im trying to CALCULATE THE NUMBER OF MONTHS between two dates IN TWO DIFFERENT YEARS
this code, returns the number of months which is correct, but it doesnt count the years and so the number of months arent right.
can anyone give me an example of how to do this?
==================================
Dim today As String
Dim arrived As String
Dim lived As String
today = DatePart("m", Date)
arrivaldate = arrivdatetxt.Value
arrived = DatePart("m", arrivaldate)
lived = DateDiff("d", arrived, today)
Text21.Value = lived
End Sub
=======================
thanks
hi, here is some code i wrote, but im having some problems.
this works fine for calculating a diference in years. but im trying to CALCULATE THE NUMBER OF MONTHS between two dates IN TWO DIFFERENT YEARS
this code, returns the number of months which is correct, but it doesnt count the years and so the number of months arent right.
can anyone give me an example of how to do this?
==================================
Dim today As String
Dim arrived As String
Dim lived As String
today = DatePart("m", Date)
arrivaldate = arrivdatetxt.Value
arrived = DatePart("m", arrivaldate)
lived = DateDiff("d", arrived, today)
Text21.Value = lived
End Sub
=======================
thanks