Syntax error for ElseIf

Posted on 2014-08-18
Last Modified: 2014-08-18
I am having a problem with the syntax in line 8 and need help here please
Sub UserInput()
   Dim Results As Variant
    Results = Range("L9").Value
    If Not (IsNumeric(Results)) Then 'not a number
        MsgBox "Invalid value for Significance – must be numeric!", vbCritical
    ElseIf Results = "<=0" or Results "=>1" Then 'The value must be great than 0 and less than 1
        MsgBox "Invalid value for Significance - must not be greater than zero but less than 1!", vbCritical
    End If

End Sub

Open in new window

Question by:Frank Freese
    LVL 25

    Accepted Solution

    Did you mean this?

       ElseIf Results <= 0 or Results => 1 Then 'The value must be great than 0 and less than 1

    The error you are probably having is that after "or Results" you do not have an equivalency operator.

    Author Comment

    by:Frank Freese
    Yes it is but I've got myself into an end less loop?

    Author Closing Comment

    by:Frank Freese
    Thank you

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Threat Intelligence Starter Resources

    Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

    A2 = A1 That kind of cell reference is relative.  If you copy it from A2 to B2, then B2 will get this: B2 = B1 That's all fine and good, but if you then insert a new row above row 2, you'll find: A3 = A1 B3 = B1 This is intentional. …
    Dealing with unintended Excel Active-X resizing quirks (VBA code simulates "self correction") David Miller (dlmille) Intro Not everyone is a fan of Active-X controls in spreadsheets (as opposed to the UserForm approach, the older Form controls …
    This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.
    This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now