Click here to Skip to main content
15,886,110 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How to use range of value in select case statement in vbscript program?

thanks in advance...
VB
Dim perc
perc=InputBox("Enter the percenatage:")

Select Case perc
Case 59 To 100
MsgBox "First Class",1,"First Class"
Case 49 To 60
MsgBox "Second Class",1,"Second Class"
Case 39 To 40
MsgBox "May God Save You",1,"Third Class"
Case Else
MsgBox "Gud Luck"
End Select

Its not working?
Regards
Chandan
Posted
Updated 16-Oct-19 14:05pm
v2

you will need to use trick in this case...
try this...
VB
Dim perc
 perc=InputBox("Enter the percenatage:")
  
 Select Case True
 Case (perc > 59 and prec <= 100)
     MsgBox "First Class",1,"First Class"
 Case (perc > 49 and prec < 60)
     MsgBox "Second Class",1,"Second Class"
 Case (perc > 39 and prec < 50)
     MsgBox "May God Save You",1,"Third Class"
 Case Else
     MsgBox "Gud Luck"
 End Select

Happy Coding!
:)
 
Share this answer
 
is there a way to give a range of alphabets as well using if then else in general? i have to design a solution where if the entered string, for first condition, starts with "m" or less than M, then the output will be a certain shirt type. can you guide me on this please? i just need to know how to give the alphabetical range using if then else.
thank you
regards
 
Share this answer
 
Comments
Patrice T 16-Oct-19 23:34pm    
This is not a solution, please open a new question and delete this.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900