The year function is passed a date and returns the numerical year.
Note that to pass a constant date you must enclose it in #.....# (pound or hash). That's because if you use 3/19/2020 VBA thinks you're doing a division. The reason the last example above is returning 1899 is that dates are really the number of days between Dec. 30, 1899, and today. |