#VISUAL BASIC IF STATEMENTS CODE#
Therefore, the code will never enter more than one of the listed cases.įor further information on the VBA Select Case statement, see the Microsoft Developer Network website. You just tell the code to perform one action if a condition is true (in this case If i10). Note that as soon as one case in the Select Case statement is matched, and the corresponding code executed, the whole Select Case statement is exited. This is an example of the 'Else' condition, which is executed if your expression hasn't matched any of the previous cases This is an example of the basic test of whether your expression evaluates to a specific value They perform their tests, one after the other, until one of them is found to be true.
This statement is like a chain of If statements. Often you will want to test whether two conditions are both true.
If you have already used another programming language, chances are that you can use the if statement in C. This is a Boolean variable that signals when a condition exists. Logical Operators Within Conditionals If statements test whether a condition is true. If Condition1 is true, the program will execute Statment1 and stop examining conditions. This is an example of how you can test if your expression evaluates to any one of several values, by separating the possible values by commas In C, the if statement is very simple to use. The program will first examine Condition1.
This is an example of how you can test if your expression satisfies a condition such as <= 5 by using the keyword Case Is The above example illustrates different ways of defining the different Cases in the Select Case statement. = 255 ' Color cell interior red End Select