Solved

Select in range in VBScript

Posted on 2000-03-25
1
268 Views
Last Modified: 2006-11-17
How do I select within a range in VBScript?

*************************
Dim intInteger

intInteger = 5

Select Case intInteger
     Case 1 to 5
            'do something
     Case 6 to 10
            'do something else
End select

******************

Also tried with Cint(intInteger) and tried many strategies like
1 or 2 or 3 or 4 or 5

and

>0 & <6

etc.

Did we just get shafted on this one, or is something I'm missing?

Thanks

ic
0
Comment
Question by:ic
1 Comment
 
LVL 1

Accepted Solution

by:
mahno earned 20 total points
ID: 2661008
Hi ic,

U can select using

Dim intInteger

intInteger = 5

If intInteger >= 1 And intInteger <= 5 Then
            MsgBox "do something"
ElseIf intInteger >= 6 And intInteger <= 10 Then
            MsgBox "do something else"
End If

---Or---

Select Case intInteger
     Case 1,2,3,4,5
            MsgBox "do something"
     Case 6,7,8,9,10
            MsgBox "do something else"
End select

Hope that helps,
  mahno

0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
object oriented design (python) and documentation tools 2 101
Query Syntax 17 50
backup program with robocopy 6 72
Where to download python requests library 6 63
This is about my first experience with programming Arduino.
Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …

749 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