Code:
daysInMonth = Day(DateSerial(thisYear, thisMonth + 1, 0))
It adds 1 to the month and uses DateSerial to get a Date representing the 0th day of the following month. That is the last day of the month you entered. The Day function gives you the number of that day, which equals the number of days in the month.
Thanx buddy
This is just what we needed. Thanks. :)
Thanks, great piece of code, solved my problem :)
Thanks :D
Thanks …
To the point.. Thanks
Although it doesn’t affect, the year could change to next year when adding to month, but since it is January stays with 31 days always, it doesn’t matter.