Es gibt 2 Methoden:
Ein Parameter 1-12 für ein Array (monthnames oder builtin Customlist nit Monatsnamen)
Ein Datum das verwandelt/interpretiert wird von Format (VBA) oder Text (Excel function)
Abhängig vor der Office version ist die Customlist für Monatsnamen 4 oder 8
Ein Parameter 1-12 für ein Array (monthnames oder builtin Customlist nit Monatsnamen)
Ein Datum das verwandelt/interpretiert wird von Format (VBA) oder Text (Excel function)
Abhängig vor der Office version ist die Customlist für Monatsnamen 4 oder 8
Code:
Sub M_snb()
MsgBox MonthName(Month(Date - Day(Date)))
MsgBox MonthName((Month(Date) + 10) Mod 12 + 1)
MsgBox MonthName(Month(DateSerial(2025, Month(Date), 0)))
MsgBox MonthName((Month(DateSerial(2025, Month(Date), 1)) + 10) Mod 12 + 1)
MsgBox MonthName(Month(DateAdd("m", -1, Date)))
MsgBox MonthName(Month(Application.EoMonth(Date, -1)))
MsgBox Application.GetCustomListContents(4)(Month(Date - Day(Date)))
MsgBox Application.GetCustomListContents(4)((Month(Date) + 10) Mod 12 + 1)
MsgBox Application.GetCustomListContents(4)(Month(DateSerial(2025, Month(Date), 0)))
MsgBox Application.GetCustomListContents(4)((Month(DateSerial(2025, Month(Date), 1)) + 10) Mod 12 + 1)
MsgBox Application.GetCustomListContents(4)(Month(DateAdd("m", -1, Date)))
MsgBox Application.GetCustomListContents(4)(Month(Application.EoMonth(Date, -1)))
MsgBox Format(Date - Day(Date), "MMMM")
MsgBox Format(DateSerial(Year(Date), Month(Date) - 1, Day(Date)), "MMMM")
MsgBox Format(DateSerial(2025, Month(Date), 0), "MMMM")
MsgBox Format(DateAdd("m", -1, Date), "MMMM")
MsgBox Format(Application.EoMonth(Date, -1), "MMMM")
MsgBox Application.Text(Date - Day(Date), "MMMM")
MsgBox Application.Text(DateSerial(Year(Date), Month(Date) - 1, Day(Date)), "MMMM")
MsgBox Application.Text(DateSerial(2025, Month(Date), 0), "MMMM")
MsgBox Application.Text(DateAdd("m", -1, Date), "MMMM")
MsgBox Application.Text(Application.EoMonth(Date, -1), "MMMM")
MsgBox Application.Text(Date - Day(Date), "[$-413]MMMM")
MsgBox Application.Text(DateSerial(Year(Date), Month(Date) - 1, Day(Date)), "[$-409]MMMM")
MsgBox Application.Text(DateSerial(2025, Month(Date), 0), "[$-410]MMMM")
MsgBox Application.Text(DateAdd("m", -1, Date), "[$-406]MMMM")
MsgBox Application.Text(Application.EoMonth(Date, -1), "[$-407]MMMM")
End Sub