0

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 

1 Answer 1

2

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.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.