Hey guys,
I am trying to pull a range from an Excel cell and plug it into a SELECT statement in my VBA code. For example, cell A1 has 33,34,35 in it.
Sample Code:
exampleNum = 34
Select Case exampleNum
Case Range("A1").Value
EXanswer = "Yes"
Case Else
EXanswer = "No"
End Select
Normally if I just had:
Case 33,34,35
Then the 34 would be recognized in the range, however when I plug in the Range("A1"), it is plugged in as a string, thus it is comparing 34 to "33,34,35" as a whole and not 33,34,35. I have tried numerous things to convert to numeric/drop the quotes, etc, but no luck. Any thoughts?
Thanks in advance!
I am trying to pull a range from an Excel cell and plug it into a SELECT statement in my VBA code. For example, cell A1 has 33,34,35 in it.
Sample Code:
exampleNum = 34
Select Case exampleNum
Case Range("A1").Value
EXanswer = "Yes"
Case Else
EXanswer = "No"
End Select
Normally if I just had:
Case 33,34,35
Then the 34 would be recognized in the range, however when I plug in the Range("A1"), it is plugged in as a string, thus it is comparing 34 to "33,34,35" as a whole and not 33,34,35. I have tried numerous things to convert to numeric/drop the quotes, etc, but no luck. Any thoughts?
Thanks in advance!