Reputation: 1
Why does the Select Case statement show the message "No"?
It should be "Bubble".
Sub Macro1()
Dim Resolução As Integer
Resolução = 7
Select Case Resolução
Case Resolução = 0, 2, 3, 4, 5, 6
MsgBox ("Ghost")
Case Resolução = 1
MsgBox ("Car")
Case Resolução = 7, 8
MsgBox ("Bubble")
Case Else
MsgBox ("No")
End Select
End Sub
Upvotes: 0
Views: 75
Reputation: 51988
You are using the wrong syntax for the cases.
Rather than
Case Resolução = 0, 2, 3, 4, 5, 6
use
Case 0, 2, 3, 4, 5, 6
And similarly for the other cases.
With what you are doing, you are using a Boolean value (the result of a comparison such as Resolução = 0
) as a case label.
Upvotes: 2