ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Getting Month Name (https://www.excelbanter.com/excel-programming/332663-getting-month-name.html)

kmbarz

Getting Month Name
 
I've tried a few different ways in this macro to get the 05 to resolve to
"May" (06="June",...) but it still seems to want to remain as "05". What am
I missing here?

Sub LoadData(dt As String) 'dt comes in like 0505

mmyy = Trim(dt)
fulldate = Mid(mmyy, 1, 2) & "/01/20" & Mid(mmyy, 3, 2)
MsgBox (Format(Month(fulldate), mmm))

Chip Pearson

Getting Month Name
 
Try something like

Debug.Print Format(DateSerial(1900, 5, 1), "mmmm")


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"kmbarz" wrote in message
...
I've tried a few different ways in this macro to get the 05 to
resolve to
"May" (06="June",...) but it still seems to want to remain as
"05". What am
I missing here?

Sub LoadData(dt As String) 'dt comes in like 0505

mmyy = Trim(dt)
fulldate = Mid(mmyy, 1, 2) & "/01/20" & Mid(mmyy, 3, 2)
MsgBox (Format(Month(fulldate), mmm))





All times are GMT +1. The time now is 03:36 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com