VBA暂停十分之几秒(或毫秒) [英] VBA pausing by tenths of seconds (or milliseconds)
本文介绍了VBA暂停十分之几秒(或毫秒)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想暂停一个值< 1秒
这是我的惯例1秒
Sub Macro1()
范围(C15)。选择
ActiveCell.FormulaR1C1 =" 12"
范围(" E26")。选择
Application.Wait(Now + TimeValue( 0:00:01))
结束子
我试过0:00:00:10参数(将暂停设置为1/10秒)
Application.Wait(Now + TimeValue(" 0:00:00:10"))
这是不工作!
任何想法?
I want to pause for a value < of 1 sec
this is my routine for 1 sec
Sub Macro1()
Range("C15").Select
ActiveCell.FormulaR1C1 = "12"
Range("E26").Select
Application.Wait (Now + TimeValue("0:00:01"))
End Sub
I tried with "0:00:00:10" arguments (to set the pause to 1/10 seconds)
Application.Wait (Now + TimeValue("0:00:00:10"))
this is not working !
any idea ?
推荐答案
试试这个(1/10秒):
Hi,
Try this for (1/10th of second) :
展开 | 选择 | Wrap | 行号
返回1 / 10e秒问题,我确实更换了行
Application.Wait(现在+(&00:00:01")) - 工作正常1秒
by br />
Application.Wait(现在+ 0.00001 ) - 工作正常1秒
然后我尝试了
Application.Wait(现在+ 0.000001) - 1 / 10sec宏执行(没有错误)但是完全没有动作1/10秒也许快速
然后我尝试了任何其他数字,例如。
Application.Wait(Now + 0.000005) - 5/10sec宏不执行
范围(C15)。选择
ActiveCell.FormulaR1C1 =" 12"
范围(E26)。选择
Application.Wait(现在+ 0.00001)
所以仍然是同样的问题无法短于1秒! (虽然你的语法工作正常1秒)
Back to the 1/10e sec issue, I did replace the line
Application.Wait (Now + ("00:00:01")) - works fine for 1sec
by
Application.Wait (Now + 0.00001) - works fine for 1sec
then I tried
Application.Wait (Now + 0.000001) - 1/10sec the macro does execute (no bugs) but no action at all 1/10sec perhaps to fast
then I tried any other digits eg.
Application.Wait (Now + 0.000005) - 5/10sec the macro does not execute
Range("C15").Select
ActiveCell.FormulaR1C1 = "12"
Range("E26").Select
Application.Wait (Now + 0.00001)
So still the same problem no way to get shorter than 1 sec ! (although your syntax works fine for 1sec)
试试这个(1/10秒):
Hi,
Try this for (1/10th of second) :
展开 | 选择 | Wrap | 行号
可能它太快注意到任何差异....
但这就是毫秒通过等待的时间..
问候
Veena
Hi,
May it is too quick to notice any kind of difference....
But that is how Milliseconds are passed for Wait..
Regards
Veena
这篇关于VBA暂停十分之几秒(或毫秒)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文