?
Solved

Select in range in VBScript

Posted on 2000-03-25
1
Medium Priority
?
277 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 60 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

New benefit for Premium Members - Upgrade now!

Ready to get started with anonymous questions today? It's easy! Learn more.

Question has a verified solution.

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

Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
Make the most of your online learning experience.
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Suggested Courses

752 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