![]() |
repeat macro after time interval
Hi all,
I am trying to find a macro that will re run my macro after say 20 minutes from when it is first run (or when the spreadsheet is opened- whichever is easier) , and again 20 mintues after that etc until the spread sheet is closed. Having it avoid re running while a user is editing the spreadsheet would also be handy. Yours in confusion |
repeat macro after time interval
Mike
Take a look at the OnTime method. It runs like so Sub RunCode() Application.OnTime Now + TimeValue("00:20:00"), "RunThis" End Sub Sub RunThis() ActiveCell.Value = Now Call RunCode End Sub You could put the first code in the Workbook_Open() event in the ThisWorkbook module and this would fire when the workbook opens -- HTH Nick Hodge Microsoft MVP - Excel Southampton, England DTHIS www.nickhodge.co.uk "MikeM" wrote in message ... Hi all, I am trying to find a macro that will re run my macro after say 20 minutes from when it is first run (or when the spreadsheet is opened- whichever is easier) , and again 20 mintues after that etc until the spread sheet is closed. Having it avoid re running while a user is editing the spreadsheet would also be handy. Yours in confusion |
All times are GMT +1. The time now is 04:52 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com