Link to home
Create AccountLog in
Avatar of AFGPHXExcel
AFGPHXExcel

asked on

How do I add to an array based on a Case?

Is it possible to set the values for an Array using a Case. For example

Select Case Range("A1").Value
Case B
v_WksNames = Array("RequirementSummary")
Case C
v_WksNames = Array("Reviewer1", "LOJ")

What if the range contains both B and C? Is it possible to make the array v_WksNames = Array("RequirementSummary", "Reviewer1", "LOJ")?
Avatar of Saqib Husain
Saqib Husain
Flag of Pakistan image

If B an V are variables then the syntax looks ok. If they are values then enclose them in quotes "B" "C"
ASKER CERTIFIED SOLUTION
Avatar of Chris Bottomley
Chris Bottomley
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
SOLUTION
Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Chris, the range("A1").Value could be "BC". So in that case the OP's hypothesis seems ok.

Saqib
ssaqibh

Are you trying to say something is wrong?
I was just trying to respond to your statement

"Strictly speaking you can't since range("A1").Value cannot equal two different things..."