Simple enough to do without a macro if you want:
In B3 you'll enter the first day of a month, let's say 2/1/07.
In A10 type the formula
=$B$3+(ROW()-10)
and fill that down to A37 (this will account for the first 28 days of the month).
In A38 you need to check if it's February AND if it's a leap year. If it is a normal Feb, then A38 should be blank, but if it's a leap year then it should say 2/29. Use this formula:
=IF(AND(MONTH($B$3)=2,MOD(YEAR($B$3),4)<>0),"",$B$3+(ROW()-10))
In A39 you just need to check if it's February again, since all other months have at least 30 days. Use this formula:
=IF(MONTH($B$3)=2,"",$B$3+(ROW()-10))
Finally, in A40 you just need to check if it's not Feb, Apr, Jun, Sep or Nov, which only have 30 days. Use this formula:
=IF(MONTH($B$3)={2,4,6,9,11},"",$B$3+(ROW()-10))
There could be easier ways of doing this, but once you put these formulas in it's not like they'll need to be changed anytime soon. (I think in February of the year 2100 will be the next time this won't work, as years divisible by 100 do not have a leap day unless they are also divisible by 400, e.g. 2000, 2400. Of course, if you're still using this in the year 2100, get back to me and we'll fix you up.)![]()
Bookmarks