atw: Re: VBA Select Case Statement question.

Bruce Ashley:

Michael Lewis
------------------------
Department of Linguistics
Macquarie University

Tel (02) 9850 7856
mailto:michael.lewis@xxxxxxxxxxxxxx
------------------------

>>> <bruce.ashley@xxxxxxxx> 2007-08-23 12:31:03 >>>
Hi everyone.

Using VBA (via Excel 2003), I'm having some issues with a Select Case 
statement I'm trying to put together.

. . .

It appears that  you cannot add variables to the Select statement ie 
Select Case (priority, tempArray).

Anyone know what the rules are here (I have no reference material other 
than the Web and that has been of little help today)?

------
Me:

Can't be done -- that's not how "select case" works. One the select case line, 
you need a single expression (can involve multiple variables) that evaluates to 
a single value. Then each case corresponds to a specific value or range of 
values for that expression. In your situation, you don't have a single 
expression with multiple values; you have multiple expressions.

You might be able to perform some manipulations before the select statement so 
that you do have a single expression, or you might be able to use three select 
case sets -- two to test each of the variables and "output" a corresponding 
value; a third to test the sum of the values.

- Michael Lewis


**************************************************
To post a message to austechwriter, send the message to 
austechwriter@xxxxxxxxxxxxxx

To subscribe to austechwriter, send a message to 
austechwriter-request@xxxxxxxxxxxxx with "subscribe" in the Subject field.

To unsubscribe, send a message to austechwriter-request@xxxxxxxxxxxxx with 
"unsubscribe" in the Subject field.

To search the austechwriter archives, go to 
www.freelists.org/archives/austechwriter

To contact the list administrator, send a message to 
austechwriter-admins@xxxxxxxxxxxxx
**************************************************

Other related posts: