ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Text case question (https://www.excelbanter.com/excel-programming/431179-text-case-question.html)

Patrick C. Simonds

Text case question
 
How can I make the YES in the code below hit even if the text in TextBox1 is
lower case or a mix of both?

If TextBox4.Text = "YES" Then
OptionButton2.Value = True
Else
OptionButton1.Value = True
End If


Dave Peterson

Text case question
 
One way:

If lcase(TextBox4.Text) = lcase("YES") Then

If you're careful, you could use:
If lcase(TextBox4.Text) = "yes" Then



"Patrick C. Simonds" wrote:

How can I make the YES in the code below hit even if the text in TextBox1 is
lower case or a mix of both?

If TextBox4.Text = "YES" Then
OptionButton2.Value = True
Else
OptionButton1.Value = True
End If


--

Dave Peterson


All times are GMT +1. The time now is 02:49 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com