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

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

问题描述

我有一个Excel工作表有以下宏。我想每隔一段时间循环一下,但是如果我能找到这个功能的话,那么他会很生气。不可能吗?

  Sub Macro1()
'
'Macro1宏
'
Do
计算
'这里我想等一下

Loop
End Sub


解决方案

使用等待方法

 应用程序。等待现在+#0:00:01#

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

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


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

解决方案

Use the Wait method:

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

or (for Excel 2010 and later):

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

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

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