In this post I will explain about the structure of If and Select Case decision.
1. If ... Then
In Excel VBA, the general syntax is:
If condition Then 'Code to execute if condition is true
Else 'Code to execute if condition is false End If
In the If control structure, it is not mandatory Else or write code that would in this case. Consider the following example:
In this example, the loop is traversed For all the selected cells and sought to If this cell that has a value of 8, when you find it send a message mentioning in that cell is found the value 8.
2. Select Case
Here Select Case is used as an example, see the following code: Case
In our example, we are taking the variable Vexcel version of Excel you're using, then compare if the value is equal to "11.0" or 12.0 "and send the message if none of the above send a message that the Excel application is earlier than Excel 2003.
Greetings.
0 comments:
Post a Comment