Results 1 to 3 of 3

Thread: Passing Parameters Less Than Greater Than Or Equal To Not Equal To

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Senior Member
    Join Date
    Oct 2011
    Posts
    135
    Rep Power
    14

    Passing Parameters Less Than Greater Than Or Equal To Not Equal To

    Hi,

    I have a loop that checks for a sample:

    Code:
    If strTempAry(ciclo, 5) <= V_AV Then
    Code:
    If strTempAry(ciclo, 5) >= V_AV Then
    Wonder if you can pass as a parameter in vba: "<", "<=", ">", ">=", "=", "<>"

    Thanks in advance

  2. #2
    Administrator Excel Fox's Avatar
    Join Date
    Mar 2011
    Posts
    1,402
    Rep Power
    10
    Try something like

    Code:
    Function CheckValues(varComp1 As Variant, varComp2 As Variant, strCheckString As String) As Boolean
    
        CheckValues = Application.Evaluate(varComp1 & strCheckString & varComp2)
        
    End Function
    
    Sub Test()
    
        MsgBox CheckValues(strTempAry(ciclo, 5), V_AV, "<=")
        
    End Sub
    A dream is not something you see when you are asleep, but something you strive for when you are awake.

    It's usually a bad idea to say that something can't be done.

    The difference between dream and aim, is that one requires soundless sleep to see and the other requires sleepless efforts to achieve

    Join us at Facebook

  3. #3
    Senior Member
    Join Date
    Oct 2011
    Posts
    135
    Rep Power
    14
    Hi,

    Thanks for the suggestion, I did not know you could do it that way.
    I was already thinking about how many lines of code I had applications for such a comparison when the policy is in a spreadsheet cell
    Code:
    If strTempAry(ciclo, 5) <= V_AV And strTempAry(ciclo, 6) >= V_AV Then

Similar Threads

  1. Replies: 7
    Last Post: 05-15-2013, 02:56 PM
  2. Replies: 2
    Last Post: 12-19-2012, 11:52 PM
  3. Replies: 1
    Last Post: 06-11-2012, 07:16 PM
  4. Closing Stock Report With Parameters
    By Prabhu in forum Excel Help
    Replies: 8
    Last Post: 05-08-2012, 02:15 PM
  5. Passing a UDF as return type
    By Junoon in forum Excel Help
    Replies: 0
    Last Post: 05-05-2012, 05:26 PM

Posting Permissions

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