VBA MONTHNAME Function (Syntax + Example)

- Written by Puneet


The VBA MONTHNAME function is listed under the date and time category of VBA functions. When you use it in a VBA code, it returns the month name as a string from a valid date as per VBA. In simple words, you can extract the month value of a name from a date supplied.


MonthName(Month, [Abbreviate])


  • Month: an integer (ranging from 1 to 12) representing the month.
  • [Abbreviate]: A boolean value to specify if you need to a full name of the month or an abbreviated name [This is an optional argument and if omitted VBA takes FALSE by default].
    • Use TRUE for the abbreviated name (i.e. “Jan”, “Feb”, “Mar”, etc.) or FALSE for the full name (i.e. “January”, “February”, “March”, etc.) 


To practically understand how to use the VBA MONTHNAME function, you need to go through the below example where we have written a vba code by using it:

Sub example_MONTHNAME()
Range("B1").Value = MonthName(Range("A1"), False)   
End Sub

In the above code, we have used the MONTHNAME to get the name of the month as per the value in cell A1, and we have a 1 in cell A1, so it has returned the “January”.


  • If the value specified as the month is other than an integer or a string that can’t be recognized as a number, VBA will return the run-time 13 error.
Last Updated: June 22, 2023