ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Input Box - UPPERCASE lowercase (https://www.excelbanter.com/excel-programming/312105-input-box-uppercase-lowercase.html)

ALEX

Input Box - UPPERCASE lowercase
 
Is it possible to have a InputBox ignore the case?

CHAIR = chair = Chair = ChAiR = etc......



--
Jack of all trades... master of none..

Norman Jones

Input Box - UPPERCASE lowercase
 
Hi Alex,

Dim sStr

sStr = LCase(Application.InputBox("Type something"))
MsgBox sStr


---
Regards,
Norman



"Alex" wrote in message
...
Is it possible to have a InputBox ignore the case?

CHAIR = chair = Chair = ChAiR = etc......



--
Jack of all trades... master of none..




John Green[_4_]

Input Box - UPPERCASE lowercase
 
If you are talking about a logical test such as

If "Chair" = "chair" Then

you can place the following statement at the top of your module

Option Compare Text

This makes text comparisons non case sensitive.

Alternatively, you can use the following

If Upper(X) = Upper(Y) Then



"Alex" wrote in message
...
Is it possible to have a InputBox ignore the case?

CHAIR = chair = Chair = ChAiR = etc......



--
Jack of all trades... master of none..




Tom Ogilvy

Input Box - UPPERCASE lowercase
 
res = InputBox("Enter word")
res = lcase(res)
' or res = Ucase(res)

or if you are testing

if lcase(res) = "chair" then



--
Regards,
Tom Ogilvy

"Alex" wrote in message
...
Is it possible to have a InputBox ignore the case?

CHAIR = chair = Chair = ChAiR = etc......



--
Jack of all trades... master of none..




ALEX

Input Box - UPPERCASE lowercase
 
Actually I just want the Inputbox to ignore whatever case is entered and just
take it for what it is.

So I don't have to have every possible combination listed in a IF statement...

"John Green" wrote:

If you are talking about a logical test such as

If "Chair" = "chair" Then

you can place the following statement at the top of your module

Option Compare Text

This makes text comparisons non case sensitive.

Alternatively, you can use the following

If Upper(X) = Upper(Y) Then



"Alex" wrote in message
...
Is it possible to have a InputBox ignore the case?

CHAIR = chair = Chair = ChAiR = etc......



--
Jack of all trades... master of none..





ALEX

Input Box - UPPERCASE lowercase
 
I tried this... but it just exited out....

"Norman Jones" wrote:

Hi Alex,

Dim sStr

sStr = LCase(Application.InputBox("Type something"))
MsgBox sStr


---
Regards,
Norman



"Alex" wrote in message
...
Is it possible to have a InputBox ignore the case?

CHAIR = chair = Chair = ChAiR = etc......



--
Jack of all trades... master of none..





ALEX

Input Box - UPPERCASE lowercase
 
I'm messing around to get a better understanding of InputBoxes and IF
statements and thier it's limits...

Here's what I put together....

Dim tea As String

Mo

tea = LCase(Application.InputBox("Please enter a tea beverage", "Tea Guide"))
If tea = "" Then
Exit Sub
ElseIf tea = "Chai" Then
MsgBox ("Good Tea, try something else")
GoTo More
ElseIf tea = "Green" Then
MsgBox ("Great Tea, try something else")
GoTo More
ElseIf tea = "Black" Then
MsgBox ("Better Tea, try something else")
GoTo More
ElseIf tea = "Herbal" Then
MsgBox ("BEST TEA!!!")
Else: tea = vbCancel
Exit Sub
End If



"Alex" wrote:

Is it possible to have a InputBox ignore the case?

CHAIR = chair = Chair = ChAiR = etc......



--
Jack of all trades... master of none..


Tom Ogilvy

Input Box - UPPERCASE lowercase
 
You forgot to say none of those work unless you did

Option Compare Text

at the top of the module

If you convert tea to lower case, then it can't match a string that contains
upper case.

You should change your hard coded values to all lower case, such as Chai to
chai, Black to black, etc

--
Regards,
Tom Ogilvy

"Alex" wrote in message
...
I'm messing around to get a better understanding of InputBoxes and IF
statements and thier it's limits...

Here's what I put together....

Dim tea As String

Mo

tea = LCase(Application.InputBox("Please enter a tea beverage", "Tea

Guide"))
If tea = "" Then
Exit Sub
ElseIf tea = "Chai" Then
MsgBox ("Good Tea, try something else")
GoTo More
ElseIf tea = "Green" Then
MsgBox ("Great Tea, try something else")
GoTo More
ElseIf tea = "Black" Then
MsgBox ("Better Tea, try something else")
GoTo More
ElseIf tea = "Herbal" Then
MsgBox ("BEST TEA!!!")
Else: tea = vbCancel
Exit Sub
End If



"Alex" wrote:

Is it possible to have a InputBox ignore the case?

CHAIR = chair = Chair = ChAiR = etc......



--
Jack of all trades... master of none..




John Green[_4_]

Input Box - UPPERCASE lowercase
 
As you have converted your input to lower case, you must use lower case in
all your comparisons. For example

ElseIf tea="chai" Then

"Alex" wrote in message
...
I'm messing around to get a better understanding of InputBoxes and IF
statements and thier it's limits...

Here's what I put together....

Dim tea As String

Mo

tea = LCase(Application.InputBox("Please enter a tea beverage", "Tea

Guide"))
If tea = "" Then
Exit Sub
ElseIf tea = "Chai" Then
MsgBox ("Good Tea, try something else")
GoTo More
ElseIf tea = "Green" Then
MsgBox ("Great Tea, try something else")
GoTo More
ElseIf tea = "Black" Then
MsgBox ("Better Tea, try something else")
GoTo More
ElseIf tea = "Herbal" Then
MsgBox ("BEST TEA!!!")
Else: tea = vbCancel
Exit Sub
End If



"Alex" wrote:

Is it possible to have a InputBox ignore the case?

CHAIR = chair = Chair = ChAiR = etc......



--
Jack of all trades... master of none..





All times are GMT +1. The time now is 04:19 AM.

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