WeekdayName Function Description
The VBA WeekdayName function returns a string representing the day of the week for given a number ranging from 1 to 7.
VBA WeekdayName Syntax
The syntax for the WeekdayName function in VBA is:
WeekdayName( number, [abbreviate], [firstdayofweek] )
Parameters
number
A value ranging from 1 to 7 for which the weekday name is to be returned.
abbreviate
Optional. Boolean value. If true, the weekday name will be abbreviated. If false the weekday name will not be abbreviated.
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 WeekdayName function can be used in VBA code. Let’s look at some VBA WeekdayName function examples:
WeekdayName 1 'Result: Monday WeekdayName 2 'Result: Tuesday WeekdayName 2, False 'Result: Tuesday WeekdayName 1, True 'Result: Mon WeekdayName 1, True, vbSunday 'Result: Sun