gpt4 book ai didi

VBA:如何在应用文本时考虑 WEEKNUM 2019 值

转载 作者:行者123 更新时间:2023-12-04 20:30:48 27 4
gpt4 key购买 nike

我有一列记录了 WEEKNUM 周(本周是第 28 周),然后如果该值小于本周,则将其标记为“迟到”。代码运行良好,但比这周少的一些周是在 2019 年。我在下面添加了一张示例图片来展示我在做什么。我不确定如何调整我的 VBA 以考虑 2019 年的值。

With isum.workSheets("Orders")
With .Range(.Cells(2, "X"), .Cells(.Rows.Count, "O").End(xlUp).Offset(0, 9))
.Formula = "=weeknum(o2)"
.NumberFormat = "0_)"
.FormatConditions.Delete
With .FormatConditions.Add(Type:=xlExpression, Formula1:="=x2<weeknum(today())")
.NumberFormat = "L\at\e_)"
End With
End With

结束于

The WEEKNUM formula is applied to the receiving date

最佳答案

尝试,

...
... , Formula1:="=and(x2<weeknum(today()), year(o2)=year(today()))")
...

关于VBA:如何在应用文本时考虑 WEEKNUM 2019 值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51269998/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com