![]() |
How to fix the code for macro?
The following code is not working, does anyone have any suggestions on how to
fix the code for macro? If or(weekday(Today)=1,weekday(Today)=7,Hour(Now) 16) Then Thanks in advance for any suggestions Eric |
How to fix the code for macro?
Eric
If Weekday(Today) = 1 Or Weekday(Today) = 7 Or Hour(Now) 16 Then Mike "Eric" wrote: The following code is not working, does anyone have any suggestions on how to fix the code for macro? If or(weekday(Today)=1,weekday(Today)=7,Hour(Now) 16) Then Thanks in advance for any suggestions Eric |
How to fix the code for macro?
Hi Eric
Mike meant to say; If Weekday(Date)=1 OR Weekday(Date)=7 OR Hour(Now) 16 Then 'if any of the above conditions apply End If OR you can try If Left(Format(Date,"ddd"),1) = "S" OR Hour(Now) 16 Then 'if any of the above conditions apply End If If this post helps click Yes --------------- Jacob Skaria "Eric" wrote: The following code is not working, does anyone have any suggestions on how to fix the code for macro? If or(weekday(Today)=1,weekday(Today)=7,Hour(Now) 16) Then Thanks in advance for any suggestions Eric |
How to fix the code for macro?
Jacob,
Yes i did mean to say that, I corrected the syntax without checkuing the code properly. Thanks. Mike "Jacob Skaria" wrote: Hi Eric Mike meant to say; If Weekday(Date)=1 OR Weekday(Date)=7 OR Hour(Now) 16 Then 'if any of the above conditions apply End If OR you can try If Left(Format(Date,"ddd"),1) = "S" OR Hour(Now) 16 Then 'if any of the above conditions apply End If If this post helps click Yes --------------- Jacob Skaria "Eric" wrote: The following code is not working, does anyone have any suggestions on how to fix the code for macro? If or(weekday(Today)=1,weekday(Today)=7,Hour(Now) 16) Then Thanks in advance for any suggestions Eric |
How to fix the code for macro?
Welcome..It happens with me too.. (more now a days)
"Mike H" wrote: Jacob, Yes i did mean to say that, I corrected the syntax without checkuing the code properly. Thanks. Mike "Jacob Skaria" wrote: Hi Eric Mike meant to say; If Weekday(Date)=1 OR Weekday(Date)=7 OR Hour(Now) 16 Then 'if any of the above conditions apply End If OR you can try If Left(Format(Date,"ddd"),1) = "S" OR Hour(Now) 16 Then 'if any of the above conditions apply End If If this post helps click Yes --------------- Jacob Skaria "Eric" wrote: The following code is not working, does anyone have any suggestions on how to fix the code for macro? If or(weekday(Today)=1,weekday(Today)=7,Hour(Now) 16) Then Thanks in advance for any suggestions Eric |
How to fix the code for macro?
If or(weekday(Today)=1,weekday(Today)=7,Hour(Now) 16) Then
Hi. Just another option: 'Weekend is 6 or 7 If Weekday(Now, 2) = 6 Or Hour(Now) 16 Then = = = = = Dana DeLouis Jacob Skaria wrote: Welcome..It happens with me too.. (more now a days) "Mike H" wrote: Jacob, Yes i did mean to say that, I corrected the syntax without checkuing the code properly. Thanks. Mike "Jacob Skaria" wrote: Hi Eric Mike meant to say; If Weekday(Date)=1 OR Weekday(Date)=7 OR Hour(Now) 16 Then 'if any of the above conditions apply End If OR you can try If Left(Format(Date,"ddd"),1) = "S" OR Hour(Now) 16 Then 'if any of the above conditions apply End If If this post helps click Yes --------------- Jacob Skaria "Eric" wrote: The following code is not working, does anyone have any suggestions on how to fix the code for macro? If or(weekday(Today)=1,weekday(Today)=7,Hour(Now) 16) Then Thanks in advance for any suggestions Eric |
How to fix the code for macro?
Whatever code you use, you may want to replace the numbers that represent the
day of the week with their VBA constants (vbSunday, ..., vbSaturday). VBA's help shows the list and the values they represent. It'll make the code a little easier to read in a week or so... Eric wrote: The following code is not working, does anyone have any suggestions on how to fix the code for macro? If or(weekday(Today)=1,weekday(Today)=7,Hour(Now) 16) Then Thanks in advance for any suggestions Eric -- Dave Peterson |
How to fix the code for macro?
I have tried Now for weekday, which is working too.
Thank everyone very much for suggestions Eric "Jacob Skaria" wrote: Hi Eric Mike meant to say; If Weekday(Date)=1 OR Weekday(Date)=7 OR Hour(Now) 16 Then 'if any of the above conditions apply End If OR you can try If Left(Format(Date,"ddd"),1) = "S" OR Hour(Now) 16 Then 'if any of the above conditions apply End If If this post helps click Yes --------------- Jacob Skaria "Eric" wrote: The following code is not working, does anyone have any suggestions on how to fix the code for macro? If or(weekday(Today)=1,weekday(Today)=7,Hour(Now) 16) Then Thanks in advance for any suggestions Eric |
All times are GMT +1. The time now is 02:31 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com