ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Time Marcos on Weekday only (https://www.excelbanter.com/excel-programming/427236-time-marcos-weekday-only.html)

Elton Law[_2_]

Time Marcos on Weekday only
 
Dear Expert,

I asked a question 2 weeks ago.
How to set the time macro.
Some has replied me and asked me to check following path.
That is useful.

http://www.brainbell.com/tutorials/m...A_Set_Time.htm

But now, I want to set a time marco which only run on specified time on
weekday only.
May I know how to write in VBA please ?
Thanks so much.

Jacob Skaria

Time Marcos on Weekday only
 
Use Application.OnTime and set the time as below

Public dTime As Date

Sub MyMacro()
dTime = Now + TimeValue("00:15:00")
Application.OnTime dTime, "MyMacro"
End Sub

http://www.ozgrid.com/Excel/run-macro-on-time.htm

If this post helps click Yes
---------------
Jacob Skaria


"Elton Law" wrote:

Dear Expert,

I asked a question 2 weeks ago.
How to set the time macro.
Some has replied me and asked me to check following path.
That is useful.

http://www.brainbell.com/tutorials/m...A_Set_Time.htm

But now, I want to set a time marco which only run on specified time on
weekday only.
May I know how to write in VBA please ?
Thanks so much.


Per Jessen

Time Marcos on Weekday only
 
Hi

Use this to determine which weekday it is and then

"Elton Law" skrev i meddelelsen
...
Dear Expert,

I asked a question 2 weeks ago.
How to set the time macro.
Some has replied me and asked me to check following path.
That is useful.

http://www.brainbell.com/tutorials/m...A_Set_Time.htm

But now, I want to set a time marco which only run on specified time on
weekday only.
May I know how to write in VBA please ?
Thanks so much.



Per Jessen

Time Marcos on Weekday only
 
Hi

Use the code below to determine if the weekday fall into your criteria and
then use the OnTime statement:

Dim MyWeekDay As Long
MyWeekDay = Weekday(Date, FirstDayOfWeek:=vbMonday)
Select Case MyWeekDay
Case 1 To 5
'Monday to Friday
Application.OnTime TimeValue("08:00:00"), "MyMacro"
End Select

Hopes this helps.

---
Per

"Elton Law" skrev i meddelelsen
...
Dear Expert,

I asked a question 2 weeks ago.
How to set the time macro.
Some has replied me and asked me to check following path.
That is useful.

http://www.brainbell.com/tutorials/m...A_Set_Time.htm

But now, I want to set a time marco which only run on specified time on
weekday only.
May I know how to write in VBA please ?
Thanks so much.



Jacob Skaria

Time Marcos on Weekday only
 
Please refer the below link created by Chip Pearson at Pearson Software
Consulting, LLC

http://www.cpearson.com/excel/ontime.aspx
--
If this post helps click Yes
---------------
Jacob Skaria


"Elton Law" wrote:

Dear Expert,

I asked a question 2 weeks ago.
How to set the time macro.
Some has replied me and asked me to check following path.
That is useful.

http://www.brainbell.com/tutorials/m...A_Set_Time.htm

But now, I want to set a time marco which only run on specified time on
weekday only.
May I know how to write in VBA please ?
Thanks so much.



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

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