Last Updated on January 11, 2023 by token
1. Weekday VBA Function – Description
The Weekday VBA function returns the word name of the day of the week from numbers from 1 to 7. In the second argument of the function we can define which day of the week we consider as the first, e.g. for Poland it will be Monday.
2. VBA WeekdayName Function – Syntax
Weekday (Date, [FirstDayOfWeek As VbDayOfWeek = vbSunday])
FirstDayOfWeek : Optional argument. We can define which day is defined as the first day of the week. In Polish nomenclature it will be Monday, so vbMonday or 2.
|vbUseSystem||0||According to system / API settings|
|vbMonday||2||Monday (ISO 8601)|
Function return: String / Word name of the day of the week, eg “Thursday” or “Th”.
3. VBA Weekday function – Example
How to use Weekday function in VBA Excel? Below is an example of using the Weekday function in the VisualBasic Editor.
Example 1: Weekday VBA function. The result in the MsgBox window.
MsgBox Weekday (Date) MsgBox Weekday (Date, 1) MsgBox Weekday (Date, vbMonday)
Example 2: Weekday VBA function. The result in the MsgBox window.
Range ("A1") = Weekday (Date) Range ("A2") = Weekday (Date, 1) Range ("A3") = Weekday (Date, vbMonday)
4. VB Weekday Function – Additional information
- The second argument of the function is used to specify the first day of the week. For the Polish nomenclature it will be 2 or vbMonday.
5. Weekday VisualBasic function – Where to use?
The function can be used in: Excel 2003, Excel 2007, Excel 2010, Excel 2013, Excel 2016, Excel 2019.
The article is part of the VBA Excel function list. You can find a list of all VBA functions at this address: VBA functions .