Quantcast
Channel: Excel Help Forum - Excel Programming / VBA / Macros
Viewing all articles
Browse latest Browse all 50076

[SOLVED] End of Month Vs End of Week. Pick EOM if earlier.

$
0
0
I've been working on and developing an exported report via Excel and VBA and had originally set it up to be a monthly workbook. However, I need to make it more of a End of Week up to the last day of the month. Basically, I'm going to have monthly folders, and weekly workbooks. I fully know how to calculate End of week using...

Code:

WEdate = Format(Now() - Weekday(Now()) + 6, "mm-dd-yyyy")
and EOM by using...

Code:

Function GetNowLast() as Date

    dYear = Year(Now)
    dMonth = Month(Now)

    getDate = DateSerial(dYear, dMonth + 1, 0)

    GetNowLast = getDate

End Function

But what I am wanting do do is See if the end of the month is in that week, and before the end of the week. That way it stops that weeks workbook on the last day of the month.

Example would be how 12/31/2019 fell on Tuesday this year. So the last "week" workbook would end on Tuesday for December and the first "week" workbook of January would start on Wednesday. Any thoughts help on this issue will be appreciated. Thanks.

Viewing all articles
Browse latest Browse all 50076

Trending Articles