Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Ed Ed is offline
external usenet poster
 
Posts: 279
Default UDF - case sensitive argument

Here is my issue:
For example, txt is coming from a cell in a worksheet entered by the user.

Function Test(txt as string) as string
If (txt = "comm. lse" Or txt = "ME") Then
Do this
Else
Do that
End If
End Function

If the user enters Comm Lse, the statement will Do that instead of Do
this. Any suggestions? (drop downs are not welcomed by the users...yet!)

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 618
Default UDF - case sensitive argument

Hi Ed

if you want a case insesitive function you can do something along the
following lines

Function Test(txt As String) As String
If (LCase(txt) = "comm. lse" Or UCase(txt) = "ME") Then
Do this
Else
Do that
End If
End Function

Cheers
JulieD

"ed" wrote in message
...
Here is my issue:
For example, 'txt' is coming from a cell in a worksheet entered by the
user.

Function Test(txt as string) as string
If (txt = "comm. lse" Or txt = "ME") Then
Do this
Else
Do that
End If
End Function

If the user enters Comm Lse, the statement will "Do that" instead of "Do
this". Any suggestions? (drop downs are not welcomed by the
users...yet!)



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,624
Default UDF - case sensitive argument

If you're just worried about case:

Public Function Test(txt As String) As String
If (LCase(txt) = "comm. lse" Or UCase(txt) = "ME") Then
'Do this
Else
'Do that
End If
End Function

note that this will not catch the lack of a "." in your example.


In article ,
"ed" wrote:

Here is my issue:
For example, txt is coming from a cell in a worksheet entered by the user.

Function Test(txt as string) as string
If (txt = "comm. lse" Or txt = "ME") Then
Do this
Else
Do that
End If
End Function

If the user enters Comm Lse, the statement will Do that instead of Do
this. Any suggestions? (drop downs are not welcomed by the users...yet!)

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
countif function: how to distinguish case/make case sensitive mvwoolner Excel Worksheet Functions 3 March 18th 09 02:18 PM
Case sensitive filter Shudder777 Excel Worksheet Functions 3 February 25th 07 11:26 PM
Case sensitive filtering kk122 Excel Discussion (Misc queries) 3 May 15th 06 11:18 PM
Getting a case sensitive match? ob1kenob Excel Worksheet Functions 6 March 28th 06 05:04 AM
Case Sensitive w/ IF jeffP Excel Worksheet Functions 11 February 6th 06 01:16 AM


All times are GMT +1. The time now is 05:23 PM.

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

About Us

"It's about Microsoft Excel"