我的单元格中有一个日期值(假设A1),我想使用 VBA 检查该日期的时间是否大于或小于特定时间(假设 13 小时)。我怎样才能做到这一点?我试过:
if Cells(1,1)<TimeValue("13:00:00") then
'Something
end if
Run Code Online (Sandbox Code Playgroud)
但这没有用。
另外,如果我想获得时差,例如我想知道 13:00:00 和 13:10:00(即 10 分钟)之间的差异,我该怎么做?
小智 6
if TimeValue(Cells(1, 1).Value) < TimeValue("13:00:00") then
Run Code Online (Sandbox Code Playgroud)
应该管用。