هذا كود للاستاذ المحترم محمد صالح اعزه الله
اريد ه يعمل على الملف المرفق كرما منكم
Function mas_date_diff(oldd As Date, newd As Date, frmat As String) As String
Dim years, months, days As Integer
years = Year(newd) - Year(oldd)
If Month(newd) < Month(oldd) Then
years = years - 1
months = (Month(newd) + 12) - Month(oldd)
Else
months = Month(newd) - Month(oldd)
End If
If Day(newd) < Day(oldd) Then
months = months - 1
days = (Day(DateSerial(Year(oldd), Month(oldd) + 1, 1) - 1) - Day(oldd)) + Day(newd)
Else
days = Day(newd) - Day(oldd)
End If
If months < 0 Then
months = 11
years = years - 1
End If
mas_date_diff = IIf(frmat = "y", Format(years, "00"), IIf(frmat = "m", Format(months, "00"), IIf(frmat = "d", Format(days, "00"), Format(years, "00") & " Years, " & Format(months, "00") & " Months, and " & Format(days, "00") & " Days ")))
End Function
كشف- 12 للصف السادس 2014-2015.rar