Ali*_*Ali 3 excel datetime vba excel-vba excel-formula
我想写一个VBA,检查WEEKNUM或ISOWEEKNUM是否等于该值,然后运行其余的宏.我试过这样做但是因为使用TODAY作为arg我得到了一个错误.
小智 8
使用WorksheetFunction对象或Excel Application对象将本机函数调用到VBA中.
debug.print WorksheetFunction.WeekNum(Date)
debug.print application.WeekNum(Date)
debug.print WorksheetFunction.IsoWeekNum(Date)
debug.print application.IsoWeekNum(Date)
if application.WeekNum(Date) = 28 then
'it is currently 28
end if
Run Code Online (Sandbox Code Playgroud)
在VBA中,TODAY()函数替换为Date.
| 归档时间: |
|
| 查看次数: |
18168 次 |
| 最近记录: |