confusion123
Active Member
- Joined
- Jul 27, 2014
- Messages
- 400
I have the following select case statement:
I would like to incorporate Enums, so
However, this does not produce the desired result.
If I put "Porsche" into the Range "MyCar" and run the code, it does not recognise Style.Porsche as Porsche. Instead Style.Porsche = 1.
How can I make it work?
Thanks
Code:
Dim a As String
Select Case Range("MyCar").Value
Case "Porsche"
a = "Expensive"
Case "Fiat"
a= "Moderate"
Case "Mini"
a = "Cheap"
End Select
I would like to incorporate Enums, so
Code:
Public Enum Style
Porsche = 1
Fiat = 2
Mini = 3
End Enum
Dim a As String
Select Case Range("MyCar").Value
Case Style.Porsche
a = "Expensive"
Case Style.Fiat
a= "Moderate"
Case Style.Mini
a = "Cheap"
End Select
However, this does not produce the desired result.
If I put "Porsche" into the Range "MyCar" and run the code, it does not recognise Style.Porsche as Porsche. Instead Style.Porsche = 1.
How can I make it work?
Thanks