Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Select Case Range
How do you use Select Case if you have a range of numbers like 0<e<1
Not 0<=e<=1 that would be Case 0 to 1. Here is an example: Select Case e Case 0 'for case 0 Case 0<e<1 'this does not work 'for case 0<e<1 Case 1 'for case 1 Case Is <1 'for all cases above 1 end select |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Select Case Range
Maybe
Select Case True Case e = 0 'for case 0 Case 0 < e And e < 1 'for case 0<e<1 Case e = 1 'for case 1 Case e < 1 'for all cases above 1 End Select -- __________________________________ HTH Bob "Philosophaie" wrote in message ... How do you use Select Case if you have a range of numbers like 0<e<1 Not 0<=e<=1 that would be Case 0 to 1. Here is an example: Select Case e Case 0 'for case 0 Case 0<e<1 'this does not work 'for case 0<e<1 Case 1 'for case 1 Case Is <1 'for all cases above 1 end select |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Select Case Range
The case statement arre execute in order and stops when a match is found.
You can use the IS format Select Case e Case 0 'for case 0 Case 1 'for case 1 Case is < 1 'for case 0<e<1 "Philosophaie" wrote: How do you use Select Case if you have a range of numbers like 0<e<1 Not 0<=e<=1 that would be Case 0 to 1. Here is an example: Select Case e Case 0 'for case 0 Case 0<e<1 'this does not work 'for case 0<e<1 Case 1 'for case 1 Case Is <1 'for all cases above 1 end select |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Select Case Range
Case 0<e<1 'this does not work
Hi. The advantage of Select Case is to avoid additional calculations inside (ie 0 < e < 1). Here's one way... Sub Demo() Dim n n = 0.00001 Select Case n Case 0 Debug.Print "0" Case 1 Debug.Print "1" Case 0 To 1 Debug.Print "0-1" Case Else Debug.Print "Outside Range" End Select End Sub = = = = = HTH Dana DeLouis Philosophaie wrote: How do you use Select Case if you have a range of numbers like 0<e<1 Not 0<=e<=1 that would be Case 0 to 1. Here is an example: Select Case e Case 0 'for case 0 Case 0<e<1 'this does not work 'for case 0<e<1 Case 1 'for case 1 Case Is <1 'for all cases above 1 end select |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Select Case Range
I need a "Case" that will activate when there are values such as 0.1, 0.4,
and 0.7 and not 0 or 1. How do I find that "Case"? "Joel" wrote: The case statement arre execute in order and stops when a match is found. You can use the IS format Select Case e Case 0 'for case 0 Case 1 'for case 1 Case is < 1 'for case 0<e<1 |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Select Case Range
Just another idea.
Sub Demo() Dim n n = 0.00001 Select Case n Case Is <= 0: 'Do nothing Case Is = 1: 'Do nothing Case 0 To 1 Debug.Print "between 0 & 1" End Select End Sub = = = = = HTH Dana DeLouis Dana DeLouis wrote: Case 0<e<1 'this does not work Hi. The advantage of Select Case is to avoid additional calculations inside (ie 0 < e < 1). Here's one way... Sub Demo() Dim n n = 0.00001 Select Case n Case 0 Debug.Print "0" Case 1 Debug.Print "1" Case 0 To 1 Debug.Print "0-1" Case Else Debug.Print "Outside Range" End Select End Sub = = = = = HTH Dana DeLouis Philosophaie wrote: How do you use Select Case if you have a range of numbers like 0<e<1 Not 0<=e<=1 that would be Case 0 to 1. Here is an example: Select Case e Case 0 'for case 0 Case 0<e<1 'this does not work 'for case 0<e<1 Case 1 'for case 1 Case Is <1 'for all cases above 1 end select |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How do I write a select case statement for range | Excel Programming | |||
Case without Select Case error problem | Excel Discussion (Misc queries) | |||
Select Case on a range - problem | Excel Programming | |||
case select and a range | Excel Programming |