You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何在德语系统中用英文上月名称命名Excel工作表

Fix: Get English Previous Month Name for Excel Sheet (German System Locale)

I get it—when your system is stuck in German, all the default date formatting functions pull German month names instead of English. Let’s fix that with reliable solutions for both VBA and Excel formulas.

VBA Solution

The issue with your original VBA code is that Format() uses your system’s locale. Instead, use a hardcoded array of English month names to bypass this entirely:

Sub RenameSheetToEnglishPrevMonth()
    ' Calculate the number of the previous month (1-12)
    Dim prevMonthNum As Integer
    prevMonthNum = Month(DateAdd("M", -1, Now))
    
    ' Array of English month names (indexes 0-11 match months 1-12)
    Dim englishMonths As Variant
    englishMonths = Array("January", "February", "March", "April", "May", "June", _
                         "July", "August", "September", "October", "November", "December")
    
    ' Rename the active sheet
    ActiveSheet.Name = englishMonths(prevMonthNum - 1)
End Sub

This works every time because it doesn’t rely on system settings—we’re directly picking the correct name from our predefined list.

Excel Formula Solution

Your original CHOOSE() formula fails in January (since MONTH(TODAY())-1 becomes 0, which is invalid). Here’s a modified version that handles the January-to-December wrap-around:

=CHOOSE(MOD(MONTH(TODAY())-2,12)+1, "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December")

How it works:

  • MOD(MONTH(TODAY())-2,12) adjusts the month number to wrap around correctly (e.g., January → 11, February → 0)
  • Adding 1 shifts the result to the valid 1-12 range needed for CHOOSE()

If you want to use this formula to set the sheet name via VBA, just reference the cell containing the formula:

ActiveSheet.Name = Range("A1").Value ' Replace A1 with your formula cell

内容的提问来源于stack exchange,提问作者Deepak

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.20 10:10:54