ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Automation (https://www.excelbanter.com/excel-programming/324855-automation.html)

Chris

Automation
 
Does anyone know whether it is possible to code a spreadsheet to perform a
task at a particular time, eg 7am on a Monday? if so does the spreadsheet
have to be open?

Please reply to: cjneth(remove this

No Name

Automation
 
hi,
Read up on the ontime event in help. there are 2.
yes the spread sheet has to be open.
I use the ontime event to run a series of macros each
morning at 5:00am. i use the other ontime event to skip
weekends.
my code.
Sub macALaunchMR()

If Weekday(Now()) = 6 Then '1 = Sunday, 2 = Monday, 3
= Tuesday, ect
'ActiveCell.FormulaR1C1 = "This macro will not start
until 5:00am " & Date + 2.5

Application.OnTime Now() + 2.5 + TimeValue
("00:00:03"), "macAStart"
Else
Application.OnTime TimeValue
("05:00:00"), "macAStart"
End If

End Sub
caution: this wrapped big time.
good luck

-----Original Message-----
Does anyone know whether it is possible to code a

spreadsheet to perform a
task at a particular time, eg 7am on a Monday? if so

does the spreadsheet
have to be open?

Please reply to: cjneth(remove this
.



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

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