Weekday VBA function – Weekday number

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.

ConstantConstant numberDescription
vbUseSystem0According to system / API settings
vbSunday1Sunday (default)
vbMonday2Monday (ISO 8601)
vbTuesday3Tuesday
vbWednesday4Wednesday
vbThursday5Thursday
vbFriday6Friday
vbSaturday7Saturday

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)
Excel VBA Functions - Weekday VBA function
Excel VBA Functions – Weekday VBA function

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 .

Leave a comment

Your email address will not be published. Required fields are marked *

%d bloggers like this: