VBA Month Function
In this Article
Month Description
Returns the month (a number from 1 to 12) given a date value.
Simple Month Examples
Here is a simple Month example:
Sub Month_Example()
MsgBox Month(#2/5/2019 5:12:00 PM#)
End Sub
This code will return 2.
Month Syntax
In the VBA Editor, you can type “Month(” to see the syntax for the Month Function:
The Month function contains an argument:
Date: A valid date.
Examples of Excel VBA Month Function
MsgBox Month(#5/14/2019 5:25:00 AM#)
Result: 5
MsgBox Month("8/14/2019 15:33:00")
Result: 8
MsgBox Month("11/14/2019")
Result: 11
MsgBox Month(Now)
Result will be the month of the current system date.