Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,090
Default Select Case question

Excel XP & Win XP
I'm trying to write one line of a Select Case construct that encompasses
either one of 2 values. Something like:
Case 34 Or 116: Call DoThis
This line does not do anything, no error, does not call DoThis, nothing.
I could of course write this in 2 lines and that works perfectly.
Can this be written in one line? Thanks for your time. Otto


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 24
Default Select Case question

On Feb 28, 12:19 pm, "Otto Moehrbach" wrote:
Excel XP & Win XP
I'm trying to write one line of a Select Case construct that encompasses
either one of 2 values. Something like:
Case 34 Or 116: Call DoThis
This line does not do anything, no error, does not call DoThis, nothing.
I could of course write this in 2 lines and that works perfectly.
Can this be written in one line? Thanks for your time. Otto


You were close. Just change it to:

Case 34, 116: Call DoThis


HTH,

Mike

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,090
Default Select Case question

Thanks Mike. That makes things a lot simpler for me. Otto

"Mike Woodhouse" wrote in message
oups.com...
On Feb 28, 12:19 pm, "Otto Moehrbach" wrote:
Excel XP & Win XP
I'm trying to write one line of a Select Case construct that encompasses
either one of 2 values. Something like:
Case 34 Or 116: Call DoThis
This line does not do anything, no error, does not call DoThis, nothing.
I could of course write this in 2 lines and that works perfectly.
Can this be written in one line? Thanks for your time. Otto


You were close. Just change it to:

Case 34, 116: Call DoThis


HTH,

Mike



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 97
Default Select Case question

Excel XP & Win XP
I'm trying to write one line of a Select Case construct that
encompasses either one of 2 values. Something like:
Case 34 Or 116: Call DoThis
This line does not do anything, no error, does not call DoThis,
nothing. I could of course write this in 2 lines and that works
perfectly. Can this be written in one line? Thanks for your time. Otto


Separate them with commas, instead of OR:

Case 34, 116: Call DoThis


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Select Case question

I like to include "is":

Case is = 34, 116: Call DoThis
Case Is 123, Is < 155: Call DoThat



Otto Moehrbach wrote:

Excel XP & Win XP
I'm trying to write one line of a Select Case construct that encompasses
either one of 2 values. Something like:
Case 34 Or 116: Call DoThis
This line does not do anything, no error, does not call DoThis, nothing.
I could of course write this in 2 lines and that works perfectly.
Can this be written in one line? Thanks for your time. Otto


--

Dave Peterson


  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,090
Default Select Case question

Thanks Dave. I'll do that too. Otto
"Dave Peterson" wrote in message
...
I like to include "is":

Case is = 34, 116: Call DoThis
Case Is 123, Is < 155: Call DoThat



Otto Moehrbach wrote:

Excel XP & Win XP
I'm trying to write one line of a Select Case construct that encompasses
either one of 2 values. Something like:
Case 34 Or 116: Call DoThis
This line does not do anything, no error, does not call DoThis, nothing.
I could of course write this in 2 lines and that works perfectly.
Can this be written in one line? Thanks for your time. Otto


--

Dave Peterson



Reply
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
Case without Select Case error problem Ayo Excel Discussion (Misc queries) 2 May 16th 08 03:48 PM
select case question Gary Keramidas Excel Programming 3 April 6th 06 12:40 AM
VBA select case question Jeff Excel Discussion (Misc queries) 2 January 27th 06 04:03 AM
Select Case Question Craig Excel Programming 6 January 6th 06 10:37 AM


All times are GMT +1. The time now is 11:49 AM.

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

About Us

"It's about Microsoft Excel"