#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 244
Default Not weekday

Hello! I have a piece of code that I want to use to check if a certain date
is not a weekday, i.e. Saturday or Sunday. The date is found in the first
position of an array. Code:

If (Day(strStartDatumArray(0)) = 1 Or 7) Then
MsgBox ("not a weekday")
End If

Problem: I get the message that it is not a weekday regardless of what day
it actually is. Can anyone please see what is wrong with this code? Thanks
very much in advance!

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default Not weekday

Arne,
Try this:
Debug.Print Weekday(Now(), vbSunday)

There are a few options for the 2nd argument, depending what you want.

NickHK

"Arne Hegefors" ...
Hello! I have a piece of code that I want to use to check if a certain
date
is not a weekday, i.e. Saturday or Sunday. The date is found in the first
position of an array. Code:

If (Day(strStartDatumArray(0)) = 1 Or 7) Then
MsgBox ("not a weekday")
End If

Problem: I get the message that it is not a weekday regardless of what day
it actually is. Can anyone please see what is wrong with this code? Thanks
very much in advance!



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,494
Default Not weekday

i use something like this, with DtVal being the variable holding the date

If Weekday(DtVal, 2) 5 then


--


Gary


"Arne Hegefors" wrote in message
...
Hello! I have a piece of code that I want to use to check if a certain date
is not a weekday, i.e. Saturday or Sunday. The date is found in the first
position of an array. Code:

If (Day(strStartDatumArray(0)) = 1 Or 7) Then
MsgBox ("not a weekday")
End If

Problem: I get the message that it is not a weekday regardless of what day
it actually is. Can anyone please see what is wrong with this code? Thanks
very much in advance!



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,651
Default Not weekday

On Wed, 16 Aug 2006 06:10:03 -0700, Arne Hegefors
wrote:

Hello! I have a piece of code that I want to use to check if a certain date
is not a weekday, i.e. Saturday or Sunday. The date is found in the first
position of an array. Code:

If (Day(strStartDatumArray(0)) = 1 Or 7) Then
MsgBox ("not a weekday")
End If

Problem: I get the message that it is not a weekday regardless of what day
it actually is. Can anyone please see what is wrong with this code? Thanks
very much in advance!



What was the problem with the answers that were posted to you same question
about an hour ago? It would be useful to give the results of those attempts,
before just blindly repeating the question.
--ron
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
weekday() help please? Totti New Users to Excel 3 October 28th 08 04:43 PM
WEEKDAY() function: display TEXT not numeric weekday tom Excel Discussion (Misc queries) 3 November 21st 06 04:32 PM
WEEKDAY() Epinn New Users to Excel 29 September 10th 06 11:39 AM
Weekday LB79 Excel Worksheet Functions 2 July 28th 06 02:59 PM
Weekday Darts via OfficeKB.com Excel Discussion (Misc queries) 3 May 26th 06 06:26 PM


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

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

About Us

"It's about Microsoft Excel"