ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to set time within macro? (https://www.excelbanter.com/excel-programming/440756-how-set-time-within-macro.html)

Eric

How to set time within macro?
 
Does anyone have any suggestions on how to set time for processing the code?
I would like to add a condition that allow process the code before 4 pm,
Does anyone have any suggestions on how to do it?
Thanks in advance for any suggestions
Eric


If FileDateTime(PathFileName) Date + TimeSerial(8, 0, 0) Then {It is
working!}

I would like to add another condition that allow process the code before 4
pm, which I tried and show below, but it does not work.

If FileDateTime(PathFileName) Date + TimeSerial(8, 0, 0) Or Now <
TimeSerial(16, 0, 0) Then {It does not work!}


Jacob Skaria

How to set time within macro?
 
Instead of Now try

Time < timeserial(16,0,0)

--
Jacob


"Eric" wrote:

Does anyone have any suggestions on how to set time for processing the code?
I would like to add a condition that allow process the code before 4 pm,
Does anyone have any suggestions on how to do it?
Thanks in advance for any suggestions
Eric


If FileDateTime(PathFileName) Date + TimeSerial(8, 0, 0) Then {It is
working!}

I would like to add another condition that allow process the code before 4
pm, which I tried and show below, but it does not work.

If FileDateTime(PathFileName) Date + TimeSerial(8, 0, 0) Or Now <
TimeSerial(16, 0, 0) Then {It does not work!}



All times are GMT +1. The time now is 06:04 PM.

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