ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Last day of month is saturday or sunday? (https://www.excelbanter.com/excel-programming/400066-last-day-month-saturday-sunday.html)

Arne Hegefors

Last day of month is saturday or sunday?
 
Hi! I have a macro that loops through a series of dates and perfoms
calculations for these dates. I skip saturdays and sundays. However if the
last day of any month is saturday or sunday then i want to perform a
calculation. How can I check if a date is the last day of a month? Thanks!

Rick Rothstein \(MVP - VB\)

Last day of month is saturday or sunday?
 
Try testing your date this way...

If YourDate = DateSerial(Year(YourDate), Month(YourDate) + 1, 0) Then
' YourDate is the last day of the month
End If

Rick

"Arne Hegefors" wrote in message
...
Hi! I have a macro that loops through a series of dates and perfoms
calculations for these dates. I skip saturdays and sundays. However if the
last day of any month is saturday or sunday then i want to perform a
calculation. How can I check if a date is the last day of a month? Thanks!



Bob Phillips

Last day of month is saturday or sunday?
 
If Month(test_Date) < Month(test_Date + 1) Then
'last day of month

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Arne Hegefors" wrote in message
...
Hi! I have a macro that loops through a series of dates and perfoms
calculations for these dates. I skip saturdays and sundays. However if the
last day of any month is saturday or sunday then i want to perform a
calculation. How can I check if a date is the last day of a month? Thanks!





All times are GMT +1. The time now is 05:19 PM.

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