Jump to content

Recommended Posts

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
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
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

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...