Quote:
The first, and most notable, difference between Select Case and Switch is that the former is a statement while the latter is a function. In esssence, in programming, a statement declares something, while a function calculates something.
Quote:
ConclusionIf your code’s logic is relatively simple, you can probably get away with using either Switch or Select Case. If you just need a single output value, though, it could be better to use a VBA Switch function instead.
Conversely, if you have complex logic, you will not be able to implement it via the Switch function. Instead, Select Case (or switch case) may work out quite nicely for you. Keep in mind, complex means as little as just two lines of code, since the VBA Switch function can only handle one calculation per case.
The exception, of course, is if you want to step into the world of functional programming. Functional programming allows you to write functions as the output values in Switch, like we did on this tutorial. Just understand this could quickly make your programs cumbersome and more difficult to debug later.