Return to VBA Code Examples

VBA Weekday Function

Written by

Editorial Team

Reviewed by

Steve Rynearson

Last updated on July 19, 2021

Weekday Description

Returns a number representing the day of the week, given a date value.

Simple Weekday Examples

Here is a simple Weekday example:

Sub Weekday_Example()
    MsgBox Weekday("1/1/2019")
End Sub

This code will return 3.(Because 1/1/2019 is Tuesday)

Weekday Syntax

In the VBA Editor, you can type  “Weekday(” to see the syntax for the Weekday Function:


The Weekday function contains 2 arguments:

Date: A Valid date (as number or string)

FirstDayOfWeek: [Optional] A constant that specifies the first day of the week. If not specified, vbSunday is assumed.

Examples of Excel VBA Weekday Function

MsgBox Weekday("1/1/2019", vbMonday)

Result: 2

MsgBox Weekday("1/1/2019", vbTuesday)

Result: 1

MsgBox Weekday("1/1/2019", vbFriday)

Result: 5

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 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