Excel VBATutorial                                   Tutorial on Excel macros

 

Excel VBA Macros

Excel Macros Table of Contents

Excel Visual Basic Editor

Excel Macros Vocabulary

Excel Userforms

Excel Consulting

Excel Tutorial on Macros

Email to excel-vba.com

Questions and Answers on Excel Macros

Level: Intermediate
Topic:
Are "If" statements and "Select Case" case sensitive?

Question:
I have an "If" statement that reads like this:
If Activecell.Value="Yes" then. Some people answer yes, YES or other combinations of capital and lower case letters. How can I solve this problem?

Answer:
The first and easy solution is to use a drop-down list in the cell so that users can choose an answer. The other solution is this: If Ucase(Activecell.Value)="YES" then or If Lcase(Activecell.Value)="yes" then. The same rules and solutions apply to the powerful If statement called Select Case that you will use when you have multiple conditions.

To learn more on If statements and Select Case see lesson 20 of my Downloadable Tutorial on Excel Macros

To send your questions or comments click here

Back to Q&A on Excel Macros

Excel Tutorial on Macros

Excel VBA Macros

Excel Macros Table of Contents

Excel Visual Basic Editor

Excel Macros Vocabulary

Excel Userforms

Excel Consulting