I have dropdown box with months populated. When a month is selected I would like to then convert it to the month number is there a function that can do this?
Eg. September = 9
I have dropdown box with months populated. When a month is selected I would like to then convert it to the month number is there a function that can do this?
Eg. September = 9
Another VBA solution
For the sake of the art in addition to Siddharth's valid answer :-)
Sub SampleTM()
Dim MonthNm$: MonthNm = "September"
Debug.Print MonthNm2Num(MonthNm)
End Sub
Function MonthNm2Num(ByVal MonthNm) As Long
MonthNm2Num = Format(CDate(MonthNm & "/1 0"), "m") * 1&
End Function