VBA MonthName Function
In this Article
MonthName Description
Returns a string representing the month given a number from 1 to 12.
Simple MonthName Examples
Here is a simple MonthName example:
Sub Month_Example()
MsgBox MonthName(4)
End Sub
This code will return “April”.
MonthName Syntax
In the VBA Editor, you can type “MonthName(” to see the syntax for the MonthName Function:
The MonthName function contains 2 arguments:
Month: Integer representing a month.
Abbreviate: [Optional] Boolean value that indicates if the month name is to be abbreviated. FALSE if ommitted.
Examples of Excel VBA MonthName Function
MsgBox MonthName(2)
Result: “February”
MsgBox MonthName(2, True)
Result: “Feb”
MsgBox MonthName(9, False)
Result: “September”