简体   繁体   English

未定义VBA宏WeekNum

[英]VBA Macro WeekNum not defined

I'm trying to concancenate Year with WeekNum in VBA. 我正在尝试在VBA中将Week和Num合并为Year。 But it said that the WeekNum Sub or Function does not defined. 但是它说WeekNum Sub或Function没有定义。 How can I solve this? 我该如何解决? Here is my code : 这是我的代码:

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

*Note that I do this a line only, just using _ just for reading capability *请注意,我仅在一行上执行此操作,仅将_用于读取功能

Thanks! 谢谢! :) :)

Add Application.WorksheetFunction in front: 在前面添加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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM