VBA Month

Month Function Description

The VBA Month function returns the number of the month of the provided date. Values range from 1 to 12.

VBA Month Syntax

The syntax for the Month function in VBA is:

Month( date )

Parameters

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

Other Notes

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

Example usage

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

Month "2015-03-22"
'Result: 3

Month "2015-01-02"
'Result: 1

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