Sign in to follow this  
Followers 0
anzacfalcon

Run code in between certain month/days.

4 posts in this topic

#1 ·  Posted (edited)

Hi, i need the code to run only in between two month/day's specified.

The snippet below works perfectly but only if the Month/Day is past the specified Month/Day.

$Date = @MON & "/" & @MDAY


    If $Date > "12/22" Then
        MsgBox(64, "", "Date is valid, code will run")
    Else
        MsgBox(64, "", "Date is invalid, code will not run")
        Exit
    EndIf

This is what i have tried but is wrong.

$Date = @MON & "/" & @MDAY


    If $Date > "12/22" & $Date < "12/24" Then
        MsgBox(64, "", "Date is valid, code will run")
    Else
        MsgBox(64, "", "Date is invalid, code will not run")
        Exit
    EndIf

So how will i do this? Thanks for reading.

Edited by anzacfalcon

Share this post


Link to post
Share on other sites



Hi,

quite simple:

If $Date > "12/22" And $Date < "12/24" Then

;-))

Stefan

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Here is your code. You cannot "test" strings for bigger or smaller, you can do that with values !!!

$Date = @MON & "/" & @MDAY

If @MON = 12 then
    If @MDAY > 22 And @MDAY < 24 Then
        MsgBox(64, "", "Date is valid, code will run")
    Else
        MsgBox(64, "", "Date is invalid, code will not run")
        Exit
    EndIf
EndIf

Cram...

EDIT: MISSTYPO

Edited by cramaboule

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Believe it or not me and other guys method works fine. Thanks 99ojo, i was using "&" instead of "And" LoL, thanks again bro.

<3

Edited by anzacfalcon

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0