Weekday Function Description
The VBA Weekday function returns a number representing the day of the week for a provided date.
The syntax for the Weekday function in VBA is:
Weekday( date, [firstdayofweek] )
The date for which the weekday is to be returned. This can be a date variable or string representing a date.
Optional. Determines what is the first day of the week for this function. Default value is Monday. This can be any of the following values:
|vbUseSystem||0||Use the system settings (default)|
The Weekday function can be used in VBA code. Let’s look at some VBA Weekday function examples:
Weekday "2016-01-01" 'This was a Friday 'Result: 5 Weekday "#2/1/2015#" 'This was a Monday 'Result: 1 Dim d as Date d = #2/1/2015# Debug.Print Weekday(d) 'Result: 1