Return to VBA Code Examples

VBA DateSerial Function

DateSerial Description

Returns a date given a year, month, and day value.

Simple DateSerial Examples

Here is a simple DateSerial example:

This code will return 04/01/2019.

DateSerial Syntax

In the VBA Editor, you can type  “DateSerial(” to see the syntax for the DateSerial Function:

The DateSerial function contains 3 arguments:

Year: Integer value between 100 and 9999, or a numeric expression

Month: Integer value. Any numeric expression.

Day: Integer value. Any numeric expression.

Examples of Excel VBA DateSerial Function

Result: 04/01/2022

Based on the example above, we can see that the 40th month is April 2022, starting in January 2019.

Result: 07/10/2018

Result: 06/20/2018

VBA Coding Made Easy

Stop 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! vba save as


Learn More!