User login

A VBA Function to Get Last Date of the Week


Function LastDateOfTheWeek()
LastDateOfTheWeek = 8 - Weekday(Date) + Date
End Function

This function gets the last date of the current week.
To get the last day of the week from a specific date, we need to make a slight change and pass a Date as an argument to the function.


Function LastDateOfTheWeek2(ByVal d As Date)
LastDateOfTheWeek2 = 8 - Weekday(d) + d
End Function