LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 947
Default 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

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I write a select case statement for range ChipButtyMan Excel Programming 5 October 13th 08 10:06 PM
Case without Select Case error problem Ayo Excel Discussion (Misc queries) 2 May 16th 08 03:48 PM
Select Case on a range - problem cdb Excel Programming 4 February 11th 05 01:37 PM
case select and a range JT[_2_] Excel Programming 2 January 27th 05 10:46 PM


All times are GMT +1. The time now is 05:29 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"