11.5. The Bottom Line

Use comparison operators Comparison operators compare items using such tests as greater than or not equal to.

Master It Write a line of code that uses a less than comparison to test whether a variable named Surplus is less than 1200.

Compare one item with another You can compare strings using less than and more than comparison operators.

Master It What symbol do you use to determine if VariableA is lower in the alphabet than VariableB?

Test multiple conditions To test multiple conditions, you use VBA's logical operators to link the conditions together.

Master It Name two of the most commonly used logical operators.

Use

If
statements If blocks are among the most common programming structures. They are often the best way to allow code to make decisions. To test two conditions, use If... Else... EndIf.

Master It Write an If... Else... End If block of code that displays two message boxes. If the temperature (the variable Temp) is greater than 80, tell the user that it's hot outside. Otherwise, tell the user that it's not that hot.

Use

Select Case
statements. Select Case structures can be a useful alternative to If blocks.

Master It When should you use a Select Case structure?

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
13.59.252.227