atw: VBA Select Case Statement question.
- From: bruce.ashley@xxxxxxxx
- To: austechwriter@xxxxxxxxxxxxx
- Date: Thu, 23 Aug 2007 12:31:03 +1000
Hi everyone.
Using VBA (via Excel 2003), I'm having some issues with a Select Case
statement I'm trying to put together.
In the past I have never had to test for multiple expressions of the type
shown below and have come across what appears to be an annoying limitation
with the validation of expressions (but I'm hoping someone out there will
advise otherwise).
Only the first expression is validated so the second and third ones are
ignored.
As an 'if else' statement, these multiple expressions work fine but I
cannot find out how to validate the Case statement equivalents as follows:
Select Case priority
Case Priority = "Priority 1" And _
(tempArray(i, 2) > "0") And (tempArray(i, 2) <= "0.166664")
tempArray(i, 3) = "1"
Case Priority = "Priority 2" And _
(tempArray(i, 2) > "0") And (tempArray(i, 2) <= "0.333328")
tempArray(i, 3) ... etc
I've tried many variations such as: Case "Priority 1", (tempArray(i, 2) >
"0") , (tempArray(i, 2) <= "0.166664") etc but to no avail.
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)?
TIA.
Cheers,
Bruce Ashley
----------------------------------
MYOB Australia
bruce.ashley@xxxxxxxx
Ext 7160
----------------------------------
- Follow-Ups:
- atw: Re: VBA Select Case Statement question.
- From: Michael Lewis
- atw: Re: VBA Select Case Statement question. [SEC=UNCLASSIFIED]
- From: Howard . Silcock
- atw: Re: VBA Select Case Statement question. [SEC=UNCLASSIFIED]
- From: Howard . Silcock
Other related posts:
- » atw: VBA Select Case Statement question.
- atw: Re: VBA Select Case Statement question.
- From: Michael Lewis
- atw: Re: VBA Select Case Statement question. [SEC=UNCLASSIFIED]
- From: Howard . Silcock
- atw: Re: VBA Select Case Statement question. [SEC=UNCLASSIFIED]
- From: Howard . Silcock