Return to VBA Code Examples

VBA Day Function

Written by

Editorial Team

Reviewed by

Steve Rynearson

Last updated on July 19, 2021

Day Description

Returns the day of the month (a number from 1 to 31) given a date value.

Simple Day Examples

Here is a simple Day example:

Sub Day_Example()
    MsgBox Day(#8/15/2019#)
End Sub

This will return 15.

Day Syntax

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

The Day function contains an argument:

Date: A valid date.

Examples of Excel VBA Day Function

MsgBox Day(#10/12/2019#)

Result: 12

MsgBox Day("7/15/2019")

Result: 15

MsgBox Day(Date)

Result will be the day of the current system date.

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!

VBA Code Examples Add-in

Easily access all of the code examples found on our site.

Simply navigate to the menu, click, and the code will be inserted directly into your module. .xlam add-in.

(No installation required!)

Free Download

Return to VBA Code Examples