Return to VBA Code Examples

VBA WeekdayName Function

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:

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

MsgBox WeekdayName(2)

Result: “Monday”

MsgBox WeekdayName(2, True)

Result: “Mon”

MsgBox WeekdayName(2, False, vbMonday)

Result: “Tuesday”

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! vba save as


Learn More!
vba-free-addin

VBA Code Examples Add-in

Easily access all of the code examples found on our site.

Simply navigate to the menu, click, and the code will be inserted directly into your module. .xlam add-in.

(No installation required!)

Free Download

Return to VBA Code Examples