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
|