Hi,
I wrote a function in excel vba. return value of the function is date, but function just return value of date in cell
how can I change format of cell to date (short date is preferred)
this is my code
I wrote a function in excel vba. return value of the function is date, but function just return value of date in cell
how can I change format of cell to date (short date is preferred)
this is my code
Code:
Function Gregorian(rng As Range, Optional Mode As Boolean = False) As Date
DateArr = separate_date(rng.value) [COLOR=#339900]' such as: 1396/02/19 (jalali date)[/COLOR]
If UBound(DateArr) <> 2 Then Gregorian = CVErr(2042)
Gregorian = Date2Value(rng.value, "J") - 466699 [COLOR=#339900]' such as: 509806 - 466699 => return 43107[/COLOR]
End Function