+ Reply to Thread
Results 1 to 4 of 4

Not weekday

  1. #1
    Arne Hegefors
    Guest

    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. #2
    News
    Guest

    Re: 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" <[email protected]> ¼¶¼g©ó¶l¥ó·s»D:[email protected]...
    > 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. #3
    Gary Keramidas
    Guest

    Re: Not weekday

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

    If Weekday(DtVal, 2) > 5 then


    --


    Gary


    "Arne Hegefors" <[email protected]> wrote in message
    news:[email protected]...
    > 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. #4
    Ron Rosenfeld
    Guest

    Re: Not weekday

    On Wed, 16 Aug 2006 06:10:03 -0700, Arne Hegefors
    <[email protected]> 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 to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1