VBA 未定义宏 WeekNum
VBA Macro WeekNum not defined
我试图在 VBA 中将 Year 与 WeekNum 连接起来。但它说 WeekNum Sub 或 Function 没有定义。
我该如何解决这个问题?这是我的代码:
For lrow = EndRow To 2 Step -1
CurrentSheet.Cells(lrow, "AC").Value = _
CONCATENATE(Year(CurrentSheet.Cells(lrow, "K").Value), _
"/", Text(WeekNum(CurrentSheet.Cells(lrow, "K").Value), "00"))
Next lrow
*请注意,我只做一行,只是使用 _ 只是为了阅读能力
谢谢! :)
在前面加上Application.WorksheetFunction
:
For lrow = EndRow To 2 Step -1
CurrentSheet.Cells(lrow, "AC").Value = _
CONCATENATE(Year(CurrentSheet.Cells(lrow, "K").Value), _
"/", Text(Application.WorksheetFunction.WeekNum(CurrentSheet.Cells(lrow, "K").Value), "00"))
Next lrow
我试图在 VBA 中将 Year 与 WeekNum 连接起来。但它说 WeekNum Sub 或 Function 没有定义。 我该如何解决这个问题?这是我的代码:
For lrow = EndRow To 2 Step -1
CurrentSheet.Cells(lrow, "AC").Value = _
CONCATENATE(Year(CurrentSheet.Cells(lrow, "K").Value), _
"/", Text(WeekNum(CurrentSheet.Cells(lrow, "K").Value), "00"))
Next lrow
*请注意,我只做一行,只是使用 _ 只是为了阅读能力
谢谢! :)
在前面加上Application.WorksheetFunction
:
For lrow = EndRow To 2 Step -1
CurrentSheet.Cells(lrow, "AC").Value = _
CONCATENATE(Year(CurrentSheet.Cells(lrow, "K").Value), _
"/", Text(Application.WorksheetFunction.WeekNum(CurrentSheet.Cells(lrow, "K").Value), "00"))
Next lrow