By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,489 Members | 1,932 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,489 IT Pros & Developers. It's quick & easy.

Last day of the month

P: n/a
What's the best way in vba code to get the last day of the month for a given
date, i.e.
12/01/2004 gives 12/31/2004
12/14/2004 gives 12/31/2004
12/31/2004 gives 12/31/2004
?

Robert
Nov 13 '05 #1
Share this Question
Share on Google+
6 Replies


P: n/a
"Robert" <pr**********@yahoo.com> wrote in message
news:3w*****************@fe07.lga...
What's the best way in vba code to get the last day of the month for a given date, i.e.
12/01/2004 gives 12/31/2004
12/14/2004 gives 12/31/2004
12/31/2004 gives 12/31/2004


LastDayOfMonth: DateSerial(Year(DateField), Month(DateField) + 1, 0)

--
I don't check the Email account attached
to this message. Send instead to...
RBrandt at Hunter dot com
Nov 13 '05 #2

P: n/a
Robert wrote:
What's the best way in vba code to get the last day of the month for a given
date, i.e.
12/01/2004 gives 12/31/2004
12/14/2004 gives 12/31/2004
12/31/2004 gives 12/31/2004


Best, best...

Function monthEnd(dIn as date)as date
monthend=dateserial(year(din),month(din)+1,0)
end function

--
Bas Cost Budde, Holland
http://www.heuveltop.nl/BasCB/msac_index.html
I prefer human mail above automated so in my address
replace the queue with a tea
Nov 13 '05 #3

P: n/a
Thank you. This is helpful.
"Rick Brandt" <ri*********@hotmail.com> wrote in message
news:32*************@individual.net...
"Robert" <pr**********@yahoo.com> wrote in message
news:3w*****************@fe07.lga...
What's the best way in vba code to get the last day of the month for a

given
date, i.e.
12/01/2004 gives 12/31/2004
12/14/2004 gives 12/31/2004
12/31/2004 gives 12/31/2004


LastDayOfMonth: DateSerial(Year(DateField), Month(DateField) + 1, 0)

--
I don't check the Email account attached
to this message. Send instead to...
RBrandt at Hunter dot com

Nov 13 '05 #4

P: n/a
Thank you. dateserial is the best way.
"Bas Cost Budde" <b.*********@heuvelqop.nl> wrote in message
news:cp**********@news2.solcon.nl...
Robert wrote:
What's the best way in vba code to get the last day of the month for a
given date, i.e.
12/01/2004 gives 12/31/2004
12/14/2004 gives 12/31/2004
12/31/2004 gives 12/31/2004


Best, best...

Function monthEnd(dIn as date)as date
monthend=dateserial(year(din),month(din)+1,0)
end function

--
Bas Cost Budde, Holland
http://www.heuveltop.nl/BasCB/msac_index.html
I prefer human mail above automated so in my address
replace the queue with a tea

Nov 13 '05 #5

P: n/a
Thank you.
"Rick Brandt" <ri*********@hotmail.com> wrote in message
news:32*************@individual.net...
"Robert" <pr**********@yahoo.com> wrote in message
news:3w*****************@fe07.lga...
What's the best way in vba code to get the last day of the month for a

given
date, i.e.
12/01/2004 gives 12/31/2004
12/14/2004 gives 12/31/2004
12/31/2004 gives 12/31/2004


LastDayOfMonth: DateSerial(Year(DateField), Month(DateField) + 1, 0)

--
I don't check the Email account attached
to this message. Send instead to...
RBrandt at Hunter dot com

Nov 13 '05 #6

P: n/a
Thank you.
"Bas Cost Budde" <b.*********@heuvelqop.nl> wrote in message
news:cp**********@news2.solcon.nl...
Robert wrote:
What's the best way in vba code to get the last day of the month for a
given date, i.e.
12/01/2004 gives 12/31/2004
12/14/2004 gives 12/31/2004
12/31/2004 gives 12/31/2004


Best, best...

Function monthEnd(dIn as date)as date
monthend=dateserial(year(din),month(din)+1,0)
end function

--
Bas Cost Budde, Holland
http://www.heuveltop.nl/BasCB/msac_index.html
I prefer human mail above automated so in my address
replace the queue with a tea

Nov 13 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.