TOP
# VBA Function: Weekday

## Description

### Weekday syntax

## Numbering

## VBA Weekday Example

The **VBA Weekday** function returns the number of the day of the week (from 1 to 7) for the given date.

`Weekday(date)`

Or

`Weekday(date, first_day_of_week)`

By default, the first day of the week is Sunday (1) and the last day of the week is Saturday (7).

To renumber so that Monday is the first day of the week (1) and Sunday is the last (7), add the value 2 as the second argument when using this function:

`Weekday(date, 2)`

Using the **Weekday** function to display the number of the day of the week for multiple dates:

sub example() MsgBox Weekday(#11/2/2020#, 2) 'Returns: 1 MsgBox Weekday("3.11.20", 2) 'Returns: 2 MsgBox Weekday("4 nov 2020", 2) 'Returns: 3 MsgBox Weekday("5/11/2020 17:30:21", 2) 'Returns: 4 end sub

Using the **Weekday** function to distinguish between a weekday and a weekend:

sub example() If Weekday(Now, 2) < 6 Then MsgBox "It's a weekday..." Else MsgBox "It's the weekend!" End if end sub

Function that returns the name of the day of the week: WEEKDAYNAME.

- 1. What is VBA, basic concepts.
- 2. Debugger (Debugger)
- 3. Working with sheets (Sheets)
- 4. Working with cells (Ranges)
- 5. Properties (Properties)
- 6.1. Data types (Variables)
- 6.2. Data Types (Continued)
- 7.1. Conditions (Conditions)
- 7.2. Terms (Continued)
- 8.1. Loops (Loops)
- 8.2. Cycles (Continued)
- 9. Procedures and functions
- 10. Dialog windows
- 11.1. Workbook events
- 11.2. Worksheet events
- 12.1. Custom forms
- 12.2. Controls (Controls)
- 12.3. Control elements (Continued)
- 12.4. Control elements (Exercises)
- 13.1. Arrays (Arrays)
- 13.2. Arrays (Continued)
- 13.3. Arrays (Exercises)
- 14.1. Using Excel functions
- 14.2. Creating a custom function

- 1. SQL language, basic concepts.
- 2. Data selection (SELECT)
- 3. Data sorting (ORDER BY)
- 4. Data filtering (WHERE)
- 5. Use of metacharacters (LIKE)
- 6. Calculation (calculation) fields
- 7. Data processing functions
- 8. Data grouping (GROUP BY)
- 9. Sub-requests
- 10. Combination of tables (INNER JOIN)
- 11. OUTER JOIN
- 12. Combined requests (UNION)
- 13. Adding data (INSERT INTO)
- 14. Creating tables (CREATE TABLE)

- Import of currency rates from the NBU website
- Sum written in English
- Unpivottables (Unpivot)
- Function
Google Translate - Camel Case Function
- Snake Case Function
- Kebab Case Function
- Break Case Function
- Sentence Case Function
- Title Case Function
Fuzzy Lookup Function- Function GETSUBSTR
- Free extension "YouLibreCalc"
- Professional Extension "YLC Utilities"