Greetings everyone! I have a question which I am sure can be resolved by this forum:
Using the formulae shown, I get the results shown to the left thereof:
It is unclear to me why the month goes to 'January' and 'JANUARY' in the second 2 formulae, especially
when the first formula shows '4' which is of course 'April'. Perhaps someone might explain.
I needed the month to be uppercase to check for a match to the current calendar month, so I resorted to the brute
force method which works fine (Note the 'Cells(rw1, "J")' refers to a list of dates in the format '4/10/2019'):
Recently I created a single line of code that provides the desired results as well:
It baffles me why the 'EOMONTH' function does what is needed, but the 'MONTH' function does not.
I would appreciate some clarification if possible.
Many thanks.
Perpa
Using the formulae shown, I get the results shown to the left thereof:
Code:
4 =MONTH(TODAY())
January =TEXT(MONTH(TODAY()),"mmmm")
JANUARY =Upper(TEXT(MONTH(TODAY()),"mmmm"))
when the first formula shows '4' which is of course 'April'. Perhaps someone might explain.
I needed the month to be uppercase to check for a match to the current calendar month, so I resorted to the brute
force method which works fine (Note the 'Cells(rw1, "J")' refers to a list of dates in the format '4/10/2019'):
Code:
MonthNum = Month(Cells(rw1, "J")) 'Gives the number of the month, ie. 1, 2 to 12
If MonthNum = 1 Then myMonth = "JANUARY"
If MonthNum = 2 Then myMonth = "FEBRUARY"
If MonthNum = 3 Then myMonth = "MARCH"
If MonthNum = 4 Then myMonth = "APRIL"
If MonthNum = 5 Then myMonth = "MAY"
If MonthNum = 6 Then myMonth = "JUNE"
If MonthNum = 7 Then myMonth = "JULY"
If MonthNum = 8 Then myMonth = "AUGUST"
If MonthNum = 9 Then myMonth = "SEPTEMBER"
If MonthNum = 10 Then myMonth = "OCTOBER"
If MonthNum = 11 Then myMonth = "NOVEMBER"
If MonthNum = 12 Then myMonth = "DECEMBER"
Recently I created a single line of code that provides the desired results as well:
Code:
myMonth = UCase(Application.Text(Application.EoMonth(Cells(rw1, "J"), 0), "mmmm"))
It baffles me why the 'EOMONTH' function does what is needed, but the 'MONTH' function does not.
I would appreciate some clarification if possible.
Many thanks.
Perpa
Last edited: