Weekday Function Description
The VBA Weekday function returns a number representing the day of the week for a provided date.
VBA Weekday Syntax
The syntax for the Weekday function in VBA is:
Weekday( date, [firstdayofweek] )
Parameters
date
The date for which the weekday is to be returned. This can be a date variable or string representing a date.
firstdayofweek
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:
| VBA Constant | Value | Description |
|---|---|---|
| vbUseSystem | 0 | Use the system settings (default) |
| vbSunday | 1 | Sunday |
| vbMonday | 2 | Monday |
| vbTuesday | 3 | Tuesday |
| vbWednesday | 4 | Wednesday |
| vbThursday | 5 | Thursday |
| vbFriday | 6 | Friday |
| vbSaturday | 7 | Saturday |
Example Usage
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

