Ask Your Question
2

Why does the VBA Case Select statement always default to "Case Else" and ignore matching cases?

asked 2023-02-19 11:00:00 +0000

devzero gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2022-10-03 18:00:00 +0000

nofretete gravatar image

The VBA Case Select statement does not always default to "Case Else" and ignore matching cases. If a matching case is found, then the code in that particular case block will be executed.

However, if none of the cases match the expression being evaluated, then the code in the "Case Else" block will be executed. This is because "Case Else" is used as a catch-all case for any expressions that do not match the previous cases.

It is important to ensure that all possible cases are accounted for in the select statement to avoid unintentional execution of code in the "Case Else" block.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2023-02-19 11:00:00 +0000

Seen: 13 times

Last updated: Oct 03 '22