Hi guys,
I think I have the answer to this but I don't know how to execute it in vba!
I need to figure out whether a given year is a leap year. My idea for doing this is taking the number (i.e. 2020) then dividing it by 4. If it is a whole number / Integer then it's a leap year, if it's a float value then it's not a leap year.
There's also an issue with the '00s of years, such as 1900, 2000, 2100. For them you have to divide by 400 and if it it's evenly divisible then it's a leap year and if not then it is a normal year. This is essentially the same problem of figuring out if a resultant number is an integer or a float value.
Any help si of cause appreciated, and any differing ideas would be fantastic to hear as well!
Thanks a lot,
Ryan
I think I have the answer to this but I don't know how to execute it in vba!
I need to figure out whether a given year is a leap year. My idea for doing this is taking the number (i.e. 2020) then dividing it by 4. If it is a whole number / Integer then it's a leap year, if it's a float value then it's not a leap year.
There's also an issue with the '00s of years, such as 1900, 2000, 2100. For them you have to divide by 400 and if it it's evenly divisible then it's a leap year and if not then it is a normal year. This is essentially the same problem of figuring out if a resultant number is an integer or a float value.
Any help si of cause appreciated, and any differing ideas would be fantastic to hear as well!
Thanks a lot,
Ryan