VBA:应用文本时如何考虑 WEEKNUM 2019 值
VBA: how to account for WEEKNUM 2019 values when applying text
我有一列记录了WEEKNUM周(这周是第28周)然后如果这个值小于这周,那么它被标记为"Late"。代码运行良好,但比本周少的一些周是在 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()))")
...
我有一列记录了WEEKNUM周(这周是第28周)然后如果这个值小于这周,那么它被标记为"Late"。代码运行良好,但比本周少的一些周是在 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()))")
...