I have the code:
which, when supplied the date 01-Sep-14, gives different results for my msgbox lines.
MsgBox InvDate returns "1/09/2014", which is correct.
MsgBox Month(DateAdd("m", -1, InvDate)) returns "8", which is correct.
However, MsgBox Format(Month(DateAdd("m", -1, InvDate)), "mmm") returns "Jan".
It seems in the last line the date format has reverted back to the illogical American format.
How can this be? I need the returned value to be "Aug".
Thanks Guys.
Code:
Dim InvDate As Date
InvDate = Sheets("Sale").Range("SaleDate").Value
InvDate = Format(InvDate, "dd/mm/yyyy")
MsgBox InvDate
MsgBox Month(DateAdd("m", -1, InvDate))
MsgBox Format(Month(DateAdd("m", -1, InvDate)), "mmm")
MsgBox InvDate returns "1/09/2014", which is correct.
MsgBox Month(DateAdd("m", -1, InvDate)) returns "8", which is correct.
However, MsgBox Format(Month(DateAdd("m", -1, InvDate)), "mmm") returns "Jan".
It seems in the last line the date format has reverted back to the illogical American format.
How can this be? I need the returned value to be "Aug".
Thanks Guys.