Return to VBA Code Examples

VBA MonthName Function

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”

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-free-addin

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