Results 1 to 4 of 4

Thread: [RESOLVED] select case between 3 values

  1. #1
    PowerPoster isnoend07's Avatar
    Join Date
    Feb 07
    Posts
    3,000

    Resolved [RESOLVED] select case between 3 values

    How do I write this select case
    Text1 = 50
    ThisValue = val(Text1)
    Highvalue = 500
    MedValue = 100

    Select case ThisValue
    case is > MedValue and < HighValue
    msgbox "medValue"
    case is >= Highvalue
    msgbox "HighValue"
    case else
    do nothing
    end select
    Waiting for a full featured smart phone with out marrying a provider
    Go Android
    Go raiders

  2. #2
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 02
    Location
    Bristol, UK
    Posts
    35,564

    Re: select case between 3 values

    Just think about the conditions, and re-order it:
    Code:
    Select Case ThisValue 
    Case >= Highvalue
      msgbox "HighValue"
    Case > MedValue 
      msgbox "medValue"
    case else
    
    end select

  3. #3
    PowerPoster isnoend07's Avatar
    Join Date
    Feb 07
    Posts
    3,000

    Re: select case between 3 values

    Thanks
    Didn't know it selected the first true value and not look at the others
    Waiting for a full featured smart phone with out marrying a provider
    Go Android
    Go raiders

  4. #4
    Frenzied Member
    Join Date
    Jan 09
    Location
    Watch Window(Shift+f9)
    Posts
    1,431

    Re: select case between 3 values

    Didn't know it selected the first true value and not look at the others
    yes, if first true value . it will not go at second case statement . hope it might be help.
    Code:
    Select Case ThisValue 
    Case >= Highvalue      'when it is true
      msgbox "HighValue"   'it will come here 
    Case > MedValue 
      msgbox "medValue"
    case else
    
    end select           'and finally it will come here .

Posting Permissions

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