VBA WeekdayName Function
In this Article
WeekdayName Description
Returns a string representing the day of the week given a number from 1 to 7.
Simple WeekdayName Examples
Here is a simple WeekdayName example:
1 2 3 |
Sub WeekdayName_Example() MsgBox WeekdayName(3) End Sub |
This code will return “Tuesday”.
WeekdayName Syntax
In the VBA Editor, you can type “WeekdayName(” to see the syntax for the WeekdayName Function:
The Weekday function contains 3 arguments:
Weekday: A number representing the day of the week.
Abbreviate: [Optional] Boolean value that indicates if the weekday name is to be abbreviated. If omitted, the default is False, which means that the weekday name is not abbreviated.
FirstDayOfWeek: [Optional] Numeric value indicating which day of the week should be the first day.
Examples of Excel VBA WeekdayName Function
1 |
MsgBox WeekdayName(2) |
Result: “Monday”
1 |
MsgBox WeekdayName(2, True) |
Result: “Mon”
1 |
MsgBox WeekdayName(2, False, vbMonday) |
Result: “Tuesday”
1 |
MsgBox WeekdayName(Weekday(Date)) |
Result: a string representing the day of the current system date.
VBA Coding Made Easy
Stop searching for VBA code online. Learn more about AutoMacro - A VBA Code Builder that allows beginners to code procedures from scratch with minimal coding knowledge and with many time-saving features for all users!
Learn More!