Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Is it possible to have a InputBox ignore the case?
CHAIR = chair = Chair = ChAiR = etc...... -- Jack of all trades... master of none.. |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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.. |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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.. |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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.. |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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.. |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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.. |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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.. |
#8
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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.. |
#9
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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.. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
uppercase to lowercase | Excel Discussion (Misc queries) | |||
Lowercase to uppercase | Excel Discussion (Misc queries) | |||
uppercase to lowercase | Excel Worksheet Functions | |||
lowercase to uppercase | Excel Worksheet Functions | |||
uppercase to lowercase | Excel Discussion (Misc queries) |