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")?
Microsoft Excel

Avatar of undefined
Last Comment
Saqib Husain

8/22/2022 - Mon
Saqib Husain

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
Chris Bottomley

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
SOLUTION
Chris Bottomley

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
Saqib Husain

Chris, the range("A1").Value could be "BC". So in that case the OP's hypothesis seems ok.

Saqib
Chris Bottomley

ssaqibh

Are you trying to say something is wrong?
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck
Saqib Husain

I was just trying to respond to your statement

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