Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 493
Default 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..
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default 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..



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 47
Default 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..



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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..



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 493
Default 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..






  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 493
Default 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..




  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 493
Default 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..

  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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..



  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 47
Default 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..



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
uppercase to lowercase Bob76 Excel Discussion (Misc queries) 5 February 14th 09 08:06 AM
Lowercase to uppercase workingwoman Excel Discussion (Misc queries) 3 September 14th 07 08:46 PM
uppercase to lowercase Missy Excel Worksheet Functions 1 February 3rd 05 09:10 PM
lowercase to uppercase Louise Excel Worksheet Functions 6 January 10th 05 09:41 PM
uppercase to lowercase Mammoth Excel Discussion (Misc queries) 3 November 28th 04 03:19 AM


All times are GMT +1. The time now is 12:22 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"