VBA Weekday Function
In this Article
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)
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)
MsgBox Weekday("1/1/2019", vbTuesday)
MsgBox Weekday("1/1/2019", vbFriday)
VBA Coding Made EasyStop 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!