VBA Day

Day Function Description

The VBA Day function returns the number of the day of the month provided with a date. Values range from 1 to 31.

VBA Day Syntax

The syntax for the Day function in VBA is:

Day( date )

Parameters

date
A date for which the number of the day of the month is to be returned. This can be a string of a date representation or a Date variable.

Other Notes

The VBA Day function accepts string representations of Dates as well as Date serial values (Date variables).

Example usage

The VBA Day function can be used in VBA. Let’s look at some VBA Day function examples:

Day "2015-03-22"
'Result: 22

Day "2015-01-02"
'Result: 2

Dim d as Date
d = DateValue("2015-02-02")
Debug.Print Day(d)
'Result: 2