اضافة لما تفضل به استاذي @أبو عبدالله الحلوانى
انتبه دائما الى نوع البيانات
Dim year1 As Date
Dim year2 As Date
Dim month1 As Date
Dim month2 As Date
year1 = Int(DatePart("yyyy", Vdate1))
year2 = Int(DatePart("yyyy", Vdate2))
month1 = Int(DatePart("m", Vdate1))
month2 = Int(DatePart("m", Vdate2))
If month2 < month1 Then
DatDiffY = (year2 - year1) - 1
Else
DatDiffY = year2 - year1
End If