Convert month # to month name

mv8167

Board Regular
Joined
Apr 27, 2005
Messages
103
I have:
intMonth = Month(Now)
Min1Month = CStr(intMonth - 1)

Which gives me "8".

Ho do I change the "8" to "August"?
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
check out the DateAdd VBA function..

Code:
Sub test()
Dim x As Date, y As String
x = DateAdd("m", -1, Now)
y = Format(x, "mmmm")
End Sub

Hope that helps.
 
Upvote 0
Try like this

Code:
Dim intMonth As Integer, Min1Month As Integer, sMonth As String
intMonth = Month(Now)
Min1Month = intMonth - 1
sMonth = Format(DateValue("1-" & Min1Month), "mmmm")
MsgBox sMonth
 
Last edited:
Upvote 0
i finally figured it out.

'Calculate Month as "Name"
intMonth = Month(Now)
ThisMonth = MonthName(intMonth) ' "September"
Min1Month = MonthName(intMonth - 1) ' "August"
Min6Month = MonthName(intMonth - 6) ' "March"
 
Upvote 0

Forum statistics

Threads
1,224,551
Messages
6,179,476
Members
452,915
Latest member
hannnahheileen

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top