ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   REPEAT SOME ACTION IN MACRO (https://www.excelbanter.com/excel-programming/333535-repeat-some-action-macro.html)

SURESH

REPEAT SOME ACTION IN MACRO
 
Hi dear friends,

its an simple question for you....
i want to repeat some action in my excel workbook at every 5 minuts.. by the
help of VB

just like

Private Sub Workbook_Open()
Application.ScreenUpdating = false
dim ST, NT as date
ST = timer
nt = st + TimeValue("00:05:00")
loop
if nt = timer then
call XXX
end if
do events
end loop
End Sub

can anyone help me??

thanks in advance

suresh tp



Rich_z[_14_]

REPEAT SOME ACTION IN MACRO
 

Code:
--------------------

Private Sub Workbook_Open()
Application.OnTime Now + TimeValue("00:00:05"), "OnTimer"
End Sub

Sub OnTimer
dim ST as Date, NT as date
Application.ScreenUpdating = false
'*
'* Your code here
'*
DoEvents
'*
'* Reschedule the interrupt
'*
Application.OnTime Now + TimeValue("00:00:05"), "OnTimer"
Application.ScreenUpdating = True
End Sub

--------------------


Regards

Rich


--
Rich_z
------------------------------------------------------------------------
Rich_z's Profile: http://www.excelforum.com/member.php...o&userid=24737
View this thread: http://www.excelforum.com/showthread...hreadid=384269


Dave Peterson[_5_]

REPEAT SOME ACTION IN MACRO
 
If you want to read more about Excel's VBA OnTime method, visit Chip Pearson's
site:
http://www.cpearson.com/excel/ontime.htm

SURESH wrote:

Hi dear friends,

its an simple question for you....
i want to repeat some action in my excel workbook at every 5 minuts.. by the
help of VB

just like

Private Sub Workbook_Open()
Application.ScreenUpdating = false
dim ST, NT as date
ST = timer
nt = st + TimeValue("00:05:00")
loop
if nt = timer then
call XXX
end if
do events
end loop
End Sub

can anyone help me??

thanks in advance

suresh tp


--

Dave Peterson


All times are GMT +1. The time now is 09:44 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com