Solved

Select in range in VBScript

Posted on 2000-03-25
1
272 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
Computer science students often experience many of the same frustrations when going through their engineering courses. This article presents seven tips I found useful when completing a bachelors and masters degree in computing which I believe may he…
Simple Linear Regression
Progress

728 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