ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Date Functions (https://www.excelbanter.com/excel-programming/290227-date-functions.html)

seth

Date Functions
 
Is there a native function in VBA to determine the number
of days in a specified month? For example, if I wanted
to know how many days were in January is there a function
that would return 31. This is also important for
February given leap year and all that good stuff.

Thanks,

Seth

Frank Kabel

Date Functions
 
Hi Seth
if your date is in A1 the following formula calcualtes how many days
are within that specific month:
=DAY(DATE(YEAR(A1),MONTH(A1)+1,0))

for mor information on dates/times see
http://www.cpearson.com/excel/datetime.htm

Frank

Seth wrote:
Is there a native function in VBA to determine the number
of days in a specified month? For example, if I wanted
to know how many days were in January is there a function
that would return 31. This is also important for
February given leap year and all that good stuff.

Thanks,

Seth





All times are GMT +1. The time now is 07:02 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com