vba code to get first date and last day of previous month

For example, it's January now, I want to get first date of December  as "12/01/2012", last date is "12/31/2012"

Thanks.
HemlockPrintersAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
zorvek (Kevin Jones)Connect With a Mentor ConsultantCommented:
First day of previous month:

    Debug.Print DateSerial(Year(Now()), Month(Now) - 1, 1)

Last day of previous month:

    Debug.Print DateSerial(Year(Now()), Month(Now), 0)

Kevin
0
 
MacroShadowConnect With a Mentor Commented:
Here you will find many useful date functions, for example:

    Business days between two dates.
    Business day + days = next business date
    Easter (Western)
    Age
    First Day of Quarter
    First Day of Week
    First Day of Month
    First Day of Previous Month
    First Day of Next Month
    Last Day of Quarter
    Last Day of Week
    Last Day of Month
    Last Day of Previous Month
    Last Day of Next Month
    First Weekday (sun, mon, etc) following specified date.
    Special DateDiff function that separates the answer into parts
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.