如何暂停特定的时间?(Excel/VBA) [英] How to pause for specific amount of time? (Excel/VBA)

查看:34
本文介绍了如何暂停特定的时间?(Excel/VBA)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 Excel 工作表,其中包含以下宏.我想每秒循环一次,但如果我能找到执行此操作的函数,则很危险.不可能吗?

I have an Excel worksheet that has the following macro. I'd like to loop it every second but danged if I can find the function to do that. Isn't it possible?

Sub Macro1()
'
' Macro1 Macro
'
Do
    Calculate
    'Here I want to wait for one second

Loop
End Sub

推荐答案

使用 等待方法:

Application.Wait Now + #0:00:01#

或(对于 Excel 2010 及更高版本):

or (for Excel 2010 and later):

Application.Wait Now + #12:00:01 AM#

这篇关于如何暂停特定的时间?(Excel/VBA)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆