VBA Weekday Function
In this Article
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