我有一列记录了 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
结束于
最佳答案
尝试,
...
... , Formula1:="=and(x2<weeknum(today()), year(o2)=year(today()))")
...
关于VBA:如何在应用文本时考虑 WEEKNUM 2019 值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51269998/