Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,670
Default 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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default 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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default 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

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default 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

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default 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



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 947
Default 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

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default 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
  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,670
Default 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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro code to dll and vba code trouble shoot. mario Excel Programming 0 May 15th 08 07:07 PM
Slow code when used as VBA code instead of macro (copying visible columns) [email protected] Excel Programming 3 April 2nd 07 05:26 PM
Can I use code/macro to change code/macro in an existing file? Scott Bedows Excel Programming 2 February 14th 07 05:50 AM
read macro code by vb code Francesco Geri Excel Programming 2 October 7th 05 10:24 AM
do anybody have a sample code for executing excel macro from vb code?<eom B Deepak Excel Programming 2 September 30th 05 09:59 AM


All times are GMT +1. The time now is 03:53 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"