11.2. Testing Multiple Conditions by Using Logical Operators
Often, you'll need to test two or more conditions before taking an action: if statement X is True and statement Y is True, then do this; if statement X is True or statement Y is True, then do the other; if statement X is True and statement Y isn't True, then find something else to do; and so on. For example, if it's raining and you have a cold, put on your warmest rain gear.
To test multiple conditions, you use VBA's logical operators to link the conditions together. Table 11.2 lists the logical operators that VBA supports, with short examples and comments.
|And||Conjunction||If ActiveWorkbook.FullName = "c:\temp\Example.xlsm" ...|