start code if today is monday or saturday

User avatar
sal21
PlatinumLounger
Posts: 4355
Joined: 26 Apr 2010, 17:36

start code if today is monday or saturday

Post by sal21 »

I need to start a code if this condition is true:

if today is monday or saturday or ... then
call mycode
end if

i think is podssible also with select case, or not?

User avatar
HansV
Administrator
Posts: 78493
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: start code if today is monday or saturday

Post by HansV »

You can use

Code: Select all

    Select Case Weekday(Date)
    Case 2, 7 ' Monday / Saturday
        ' Do something
    Case Else
        ' Do something else
    End Select
Best wishes,
Hans

User avatar
sal21
PlatinumLounger
Posts: 4355
Joined: 26 Apr 2010, 17:36

Re: start code if today is monday or saturday

Post by sal21 »

HansV wrote:You can use

Code: Select all

    Select Case Weekday(Date)
    Case 2, 7 ' Monday / Saturday
        ' Do something
    Case Else
        ' Do something else
    End Select
before you post and i read your solution...

If Weekday(Date) = vbTuesday Or Weekday(Date) = vbThursday Then
Call mycode
End If

wath you think about?

User avatar
HansV
Administrator
Posts: 78493
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: start code if today is monday or saturday

Post by HansV »

That's fine too.
Best wishes,
Hans