We help IT Professionals succeed at work.

Check out our new AWS podcast with Certified Expert, Phil Phillips! Listen to "How to Execute a Seamless AWS Migration" on EE or on your favorite podcast platform. Listen Now

x

VBA "Select Case" multiple conditions

Medium Priority
12,219 Views
Last Modified: 2013-11-26
Hi x-perts,

Is there a way to write a Select Case statement with a FEW executable Case options, i.e. when a=true and b = true?

of course, I can write all IF statements, but it would be much easier with Select Case

Thanks
Select Case true
     Case a
     'do something
     Case b 
     'do something
End select

Open in new window

Comment
Watch Question

Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION

Author

Commented:
I mean not INSIDE of a Case, but execute a few Case statements in a row, if conditions are satisfied, i.e. perform Case a AND Case b

is it possible somehow?
Guy Hengel [angelIII / a3]Billing Engineer
CERTIFIED EXPERT
Most Valuable Expert 2014
Top Expert 2009

Commented:
you mean:
Select Case true
     Case a OR c OR d
     'do something
     Case b 
     'do something
End select

Open in new window

Author

Commented:
Yes, if both the conditions are true, ex a = true and b = true, it will only execute the first, i.e. a=true condition and exit. Case b will not be checked and executed

what I need is to execute ALL individual Case statement, if the conditions are satisfied.
Billing Engineer
CERTIFIED EXPERT
Most Valuable Expert 2014
Top Expert 2009
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.